summaryrefslogtreecommitdiff
path: root/misc/logsave.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2004-03-04 20:30:16 -0500
committerTheodore Ts'o <tytso@mit.edu>2004-03-04 20:30:16 -0500
commit5bec574043035397b190c01d1164940956f4d7b5 (patch)
tree8b13730b27aabfd1663c680ca244cc5cd6600394 /misc/logsave.c
parent9387c281ef88cd1fba7cb1c9336b5ab00a2d82b4 (diff)
downloade2fsprogs-5bec574043035397b190c01d1164940956f4d7b5.tar.gz
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.
Diffstat (limited to 'misc/logsave.c')
-rw-r--r--misc/logsave.c5
1 files changed, 3 insertions, 2 deletions
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);