#! /bin/sh /usr/share/dpatch/dpatch-run ## 50_bootlogd_exitcode.dpatch by Petter Reinholdtsen ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Make sure bootlogd return non-error exit code when forking off the ## DP: child. Fixes bug #326640. @DPATCH@ Index: sysvinit/src/bootlogd.c =================================================================== --- sysvinit/src/bootlogd.c (revisjon 56) +++ sysvinit/src/bootlogd.c (arbeidskopi) @@ -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) {