Whamcloud - gitweb
logsave.c (main): Use setsid() to avoid getting killed by init
authorTheodore Ts'o <tytso@mit.edu>
Fri, 5 Mar 2004 01:30:16 +0000 (20:30 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 5 Mar 2004 01:30:16 +0000 (20:30 -0500)
(run_program): Add a newline after reporting the exit code
or signal when the program exits.

misc/ChangeLog
misc/logsave.c

index 2d5c220..767f7f1 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-04  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.35
index 9790047..f256c20 100644 (file)
@@ -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);