changeset 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 a3e674fade6c
files src/readpst.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
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];