[Pkg-sysvinit-commits] r1430 - in sysvinit-upstream/trunk: doc src

Petter Reinholdtsen pere at alioth.debian.org
Sat Jul 11 06:35:34 UTC 2009


Author: pere
Date: 2009-07-11 06:35:33 +0000 (Sat, 11 Jul 2009)
New Revision: 1430

Modified:
   sysvinit-upstream/trunk/doc/Changelog
   sysvinit-upstream/trunk/src/bootlogd.c
Log:
Make sure bootlogd exit with non-error exit code when forking of
the child successfully.


Modified: sysvinit-upstream/trunk/doc/Changelog
===================================================================
--- sysvinit-upstream/trunk/doc/Changelog	2009-07-10 21:57:23 UTC (rev 1429)
+++ sysvinit-upstream/trunk/doc/Changelog	2009-07-11 06:35:33 UTC (rev 1430)
@@ -41,6 +41,8 @@
     Thomas Woerner and Fedora.
   * Adjust init to terminate argv0 with one 0 rather than two so that
     process name can be one character longer.  Patch by Kir Kolyshkin.
+  * Make sure bootlogd exit with non-error exit code when forking of
+    the child successfully.
 
  -- Petter Reinholdtsen <pere at debian.org>  Fri, 30 Jul 2004 14:14:58 +0200
 

Modified: sysvinit-upstream/trunk/src/bootlogd.c
===================================================================
--- sysvinit-upstream/trunk/src/bootlogd.c	2009-07-10 21:57:23 UTC (rev 1429)
+++ sysvinit-upstream/trunk/src/bootlogd.c	2009-07-11 06:35:33 UTC (rev 1430)
@@ -523,8 +523,19 @@
 	 *	Fork and write pidfile if needed.
 	 */
 	if (!dontfork) {
-		if (fork())
+		pid_t child_pid = fork();
+		switch (child_pid) {
+		case -1: /* I am parent and the attempt to create a child failed */
+			fprintf(stderr, "bootlogd: fork failed: %s\n",
+				strerror(errno));
 			exit(1);
+			break;
+		case 0: /* I am the child */
+			break;
+		default: /* I am parent and got child's pid */
+			exit(0);
+			break;
+		}
 		setsid();
 	}
 	if (pidfile) {




More information about the Pkg-sysvinit-commits mailing list