[PATCH] fix some fatal messages

Olof Johansson olof at lixom.net
Thu Feb 2 10:04:24 EST 2006


The fatal messages don't pad a space between the string and the error
code. Seems like most places do it by hand, so do it at the rest of them
too:


Signed-off-by: Olof Johansson <olof at lixom.net>


Index: ccontrol-0.8.3/ccontrol-lock.c
===================================================================
--- ccontrol-0.8.3.orig/ccontrol-lock.c	2005-12-19 16:20:02.000000000 +1100
+++ ccontrol-0.8.3/ccontrol-lock.c	2006-02-02 08:44:21.000000000 +1100
@@ -27,7 +27,7 @@ static void fcntl_lock(int fd, bool lock
 	fl.l_len = 1;
 
 	if (fcntl(fd, F_SETLKW, &fl) < 0)
-		fatal("cannot lock config file", errno, NULL);
+		fatal("cannot lock config file ", errno, NULL);
 }
 
 /* To create an initialized semaphore, we need a lock.  Use fcntl lock. */
@@ -53,10 +53,10 @@ static int make_semaphore(int fd, struct
 		ds.sem_perm.mode = 0600;
 		
 		if (semctl(id, 0, IPC_SET, &ds) < 0)
-			fatal("cannot set semaphore permissions",
+			fatal("cannot set semaphore permissions ",
 			      errno, NULL);
 		if (semctl(id, 0, SETVAL, sec.cpus) < 0)
-			fatal("cannot set semaphore value", errno, NULL);
+			fatal("cannot set semaphore value ", errno, NULL);
 	}
 	fcntl_lock(fd, false, 0);
 	return id;
@@ -75,7 +75,7 @@ static void grab_sem(int fd, struct sect
 	if (id < 0 && errno == ENOENT)
 		id = make_semaphore(fd, sec, key);
 	if (id < 0)
-		fatal("cannot get semaphore", errno, NULL);
+		fatal("cannot get semaphore ", errno, NULL);
 
 again:
 	sop.sem_num = 0;
@@ -85,7 +85,7 @@ again:
 	if (semop(id, &sop, 1) != 0) {
 		if (errno == EINTR)
 			goto again;
-		fatal("cannot decrement semaphore", errno, NULL);
+		fatal("cannot decrement semaphore ", errno, NULL);
 	}
 }
 
@@ -121,14 +121,14 @@ static void undo_drop_sem(void)
 
 	id = semget(key, 1, 0);
 	if (id < 0)
-		fatal("cannot re-get semaphore", errno, NULL);
+		fatal("cannot re-get semaphore ", errno, NULL);
 
 	sop.sem_num = 0;
 	sop.sem_op = 1;
 	sop.sem_flg = SEM_UNDO;
 
 	if (semop(id, &sop, 1) != 0)
-		fatal("cannot increment semaphore", errno, NULL);
+		fatal("cannot increment semaphore ", errno, NULL);
 
 	unsetenv("CCONTROL_LOCK");
 }
@@ -190,7 +190,7 @@ undofn_t grab_lock(int fd, struct sectio
 			distcc_lim /= 2;
 
 		if (lock && lock[0] == '1')
-			fatal("called myself?", 0, NULL);
+			fatal("called myself? ", 0, NULL);
 		verbose(sec, "Getting fast lock for compile", NULL);
 		grab_fcntl_lock(fd, 1, distcc_lim);
 		set_lock_envvar('1');
Index: ccontrol-0.8.3/ccontrol.c
===================================================================
--- ccontrol-0.8.3.orig/ccontrol.c	2005-12-30 00:04:05.000000000 +1100
+++ ccontrol-0.8.3/ccontrol.c	2006-02-02 08:43:45.000000000 +1100
@@ -176,7 +176,7 @@ static int fork_command(struct section s
 	int status, pid = fork();
 
 	if (pid < 0)
-		fatal("failed to fork", errno, NULL);
+		fatal("failed to fork ", errno, NULL);
 	if (pid == 0)
 		run_command(sec, argv);
 	verbose(sec, "Forked ", int_to_string(pid), NULL);
Index: ccontrol-0.8.3/stdrusty.c
===================================================================
--- ccontrol-0.8.3.orig/stdrusty.c	2005-12-21 15:05:53.000000000 +1100
+++ ccontrol-0.8.3/stdrusty.c	2006-02-02 08:44:36.000000000 +1100
@@ -63,7 +63,7 @@ void *realloc_nofail(void *ptr, size_t s
         ptr = realloc(ptr, size);
 	if (ptr)
 		return ptr;
-	fatal("realloc failed", errno, NULL);
+	fatal("realloc failed ", errno, NULL);
 }
 
 /* This version adds one byte (for nul term) */



More information about the ccontrol mailing list