Blame SOURCES/cronie-1.4.11-temp-name.patch

f83704
diff -up cronie-1.4.11/src/crontab.c.temp-name cronie-1.4.11/src/crontab.c
f83704
--- cronie-1.4.11/src/crontab.c.temp-name	2016-02-23 15:32:33.754463457 +0100
f83704
+++ cronie-1.4.11/src/crontab.c	2016-02-23 15:33:17.401466818 +0100
f83704
@@ -104,7 +104,7 @@ edit_cmd(void),
f83704
 poke_daemon(void),
f83704
 check_error(const char *), parse_args(int c, char *v[]), die(int) ATTRIBUTE_NORETURN;
f83704
 static int replace_cmd(void), hostset_cmd(void), hostget_cmd(void);
f83704
-static char *host_specific_filename(const char *filename, int prefix);
f83704
+static char *host_specific_filename(const char *prefix, const char *suffix);
f83704
 static const char *tmp_path(void);
f83704
 
f83704
 static void usage(const char *msg) ATTRIBUTE_NORETURN;
f83704
@@ -445,26 +445,27 @@ static const char *tmp_path(void) {
f83704
 	return tmpdir ? tmpdir : "/tmp";
f83704
 }
f83704
 
f83704
-static char *host_specific_filename(const char *filename, int prefix)
f83704
+static char *host_specific_filename(const char *prefix, const char *suffix)
f83704
 {
f83704
 	/*
f83704
 	 * For cluster-wide use, where there is otherwise risk of the same
f83704
-	 * name being generated on more than one host at once, prefix with
f83704
-	 * "hostname." or suffix with ".hostname" as requested, and return
f83704
-	 * static buffer or NULL on failure.
f83704
+	 * name being generated on more than one host at once, insert hostname
f83704
+	 * separated with dots, and return static buffer or NULL on failure.
f83704
 	 */
f83704
 
f83704
 	static char safename[MAX_FNAME];
f83704
-	char hostname[MAXHOSTNAMELEN];
f83704
+	char hostname[MAX_FNAME];
f83704
 
f83704
 	if (gethostname(hostname, sizeof hostname) != 0)
f83704
 		return NULL;
f83704
 
f83704
 	if (prefix) {
f83704
-		if (!glue_strings(safename, sizeof safename, hostname, filename, '.'))
f83704
+		if (!glue_strings(safename, sizeof safename, prefix, hostname, '.'))
f83704
 			return NULL;
f83704
-	} else {
f83704
-		if (!glue_strings(safename, sizeof safename, filename, hostname, '.'))
f83704
+		strcpy(hostname, safename);
f83704
+	}
f83704
+	if (suffix) {
f83704
+		if (!glue_strings(safename, sizeof safename, hostname, suffix, '.'))
f83704
 			return NULL;
f83704
 	}
f83704
 
f83704
@@ -745,7 +746,7 @@ static int replace_cmd(void) {
f83704
 	char *safename;
f83704
 
f83704
 
f83704
-	safename = host_specific_filename("tmp.XXXXXXXXXX", 1);
f83704
+	safename = host_specific_filename("#tmp", "XXXXXXXXXX");
f83704
 	if (!safename || !glue_strings(TempFilename, sizeof TempFilename, SPOOL_DIR,
f83704
 			safename, '/')) {
f83704
 		TempFilename[0] = '\0';
f83704
@@ -911,7 +912,7 @@ static int hostset_cmd(void) {
f83704
 	if (!HostSpecified)
f83704
 		gethostname(Host, sizeof Host);
f83704
 	
f83704
-	safename = host_specific_filename("tmp.XXXXXXXXXX", 1);
f83704
+	safename = host_specific_filename("#tmp", "XXXXXXXXXX");
f83704
 	if (!safename || !glue_strings(TempFilename, sizeof TempFilename, SPOOL_DIR,
f83704
 		safename, '/')) {
f83704
 		TempFilename[0] = '\0';