tags 326640 + patch confirmed thanks [Yann Rouillard] > If I understand well, for the parent, fork will return with the > child pid, so exit(1) will be executed and hence 1 will be the > return code for successfull forking. Am I wrong somewhere ?
Ah, right. I looked for return statements in main(), and did not discover that exit() call. Yes, I believe you are right. This patch should fix it. Index: src/bootlogd.c =================================================================== --- src/bootlogd.c (revisjon 56) +++ 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: /* error */ + fprintf(stderr, "bootlogd: fork failed: %s\n", + strerror(errno)); exit(1); + ;; + case 0: /* child, ignore */ + ;; + default: /* parend with child pid returned from fork() */ + exit(0); + ;; + } setsid(); } if (pidfile) { -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]