comparison 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
comparison
equal deleted inserted replaced
357:544d57fe6bc6 358:6abc3054cba2
177 if (WIFSIGNALED(status)) { 177 if (WIFSIGNALED(status)) {
178 int sig = WTERMSIG(status); 178 int sig = WTERMSIG(status);
179 DEBUG_INFO(("Process %d terminated with signal %d\n", child, sig)); 179 DEBUG_INFO(("Process %d terminated with signal %d\n", child, sig));
180 //printf("Process %d terminated with signal %d\n", child, sig); 180 //printf("Process %d terminated with signal %d\n", child, sig);
181 //fflush(stdout); 181 //fflush(stdout);
182 }
183 if (status != 0) {
184 exit(status);
182 } 185 }
183 // this has terminated, remove it from the list 186 // this has terminated, remove it from the list
184 for (j=i; j<active_children-1; j++) { 187 for (j=i; j<active_children-1; j++) {
185 child_processes[j] = child_processes[j+1]; 188 child_processes[j] = child_processes[j+1];
186 } 189 }