]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
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 2d5c220757e52a73db2445c597a2250e766f1a41..767f7f1298e11601d14700fd11483e617ef921df 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 97900470153250acff568a44e6021e6d6566b8b9..f256c20e925576161c4b8f8d6c14ee4ae50d5107 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);