diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index bf152a65680faf74882e62d6c923ad2e4ce979d4..6ceebf0bc4e4a8d8af4e8f609a87a358d0221fa3 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -2555,7 +2555,7 @@ static void _verify_clustername(void)
 				slurmctld_conf.cluster_name, filename);
 			exit(1);
 		}
-	} else {
+	} else if (slurmctld_conf.cluster_name) {
 		debug("creating clustername file: %s", filename);
 		if (!(fp = fopen(filename, "w"))) {
 			fatal("%s: failed to create file %s",