#! /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,17 @@ * Fork and write pidfile if needed. */ if (!dontfork) { - if (fork()) + pid_t child_pid = fork(); + switch (child_pid) { + case -1: /* error */ + fprintf(stderr, "bootlogd: fork failed: %s\n", + strerror(errno)); exit(1); + case 0: /* child, ignore */ + break; + default: /* parend with child pid returned from fork() */ + exit(0); + } setsid(); } if (pidfile) {