diff src/readpst.c @ 358:6abc3054cba2

From Jeffrey Morlan: If a readpst child process fails with a nonzero status code for whatever reason (killed, segfault, out-of-memory, ...) the parent process will continue and likely end up exiting with status 0, tricking the caller into thinking readpst was successful when it was not.
author Carl Byington <carl@five-ten-sg.com>
date Wed, 06 Jul 2016 10:19:01 -0700
parents 544d57fe6bc6
children 3a1d25c579c6
line wrap: on
line diff
--- a/src/readpst.c	Wed Jul 06 10:17:49 2016 -0700
+++ b/src/readpst.c	Wed Jul 06 10:19:01 2016 -0700
@@ -180,6 +180,9 @@
                     //printf("Process %d terminated with signal %d\n", child, sig);
                     //fflush(stdout);
                 }
+                if (status != 0) {
+                    exit(status);
+                }
                 // this has terminated, remove it from the list
                 for (j=i; j<active_children-1; j++) {
                     child_processes[j] = child_processes[j+1];