From: Theodore Ts'o Date: Fri, 5 Mar 2004 01:30:16 +0000 (-0500) Subject: logsave.c (main): Use setsid() to avoid getting killed by init X-Git-Tag: APPLE_UUID_SNAP_1~26 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=5bec574043035397b190c01d1164940956f4d7b5;p=tools%2Fe2fsprogs.git logsave.c (main): Use setsid() to avoid getting killed by init (run_program): Add a newline after reporting the exit code or signal when the program exits. --- diff --git a/misc/ChangeLog b/misc/ChangeLog index 2d5c220..767f7f1 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,9 @@ +2004-03-04 Theodore Ts'o + + * logsave.c (main): Use setsid() to avoid getting killed by init + (run_program): Add a newline after reporting the exit code + or signal when the program exits. + 2004-02-28 Theodore Ts'o * Release of E2fsprogs 1.35 diff --git a/misc/logsave.c b/misc/logsave.c index 9790047..f256c20 100644 --- a/misc/logsave.c +++ b/misc/logsave.c @@ -139,13 +139,13 @@ static int run_program(char **argv) rc = WEXITSTATUS(status); if (rc) { send_output(argv[0], 0, SEND_BOTH); - sprintf(buffer, " died with exit status %d", rc); + sprintf(buffer, " died with exit status %d\n", rc); send_output(buffer, 0, SEND_BOTH); } } else { if (WIFSIGNALED(status)) { send_output(argv[0], 0, SEND_BOTH); - sprintf(buffer, "died with signal %d", + sprintf(buffer, "died with signal %d\n", WTERMSIG(status)); send_output(buffer, 0, SEND_BOTH); rc = 1; @@ -248,6 +248,7 @@ int main(int argc, char **argv) outfn); exit(rc); } + setsid(); /* To avoid getting killed by init */ while (outfd < 0) { outfd = open(outfn, openflags, 0644); sleep(1);