From 5bec574043035397b190c01d1164940956f4d7b5 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 4 Mar 2004 20:30:16 -0500 Subject: 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. --- misc/logsave.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'misc/logsave.c') diff --git a/misc/logsave.c b/misc/logsave.c index 97900470..f256c20e 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); -- cgit v1.2.3