diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-05-06 02:54:35 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-05-06 02:54:35 +0000 |
commit | 47a0786034bdfc849bb5aacd55640862252d9bb4 (patch) | |
tree | c0f2421be7bc45a68f8983ff93345f60c804c12f /converter/other/tifftopnm.c | |
parent | 9ba114c3ad06f0e09c27c5f1af294359acc092bd (diff) | |
download | netpbm-mirror-47a0786034bdfc849bb5aacd55640862252d9bb4.tar.gz netpbm-mirror-47a0786034bdfc849bb5aacd55640862252d9bb4.tar.xz netpbm-mirror-47a0786034bdfc849bb5aacd55640862252d9bb4.zip |
Deal properly with failed Pamflip process
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2758 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/tifftopnm.c')
-rw-r--r-- | converter/other/tifftopnm.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c index 0d6494f9..f9e602ff 100644 --- a/converter/other/tifftopnm.c +++ b/converter/other/tifftopnm.c @@ -782,14 +782,22 @@ spawnWithInputPipe(const char * const shellCmd, else *errorP = NULL; } else { - int rc; + int terminationStatus; close(fd[PIPE_WRITE]); close(STDIN_FILENO); dup2(fd[PIPE_READ], STDIN_FILENO); - rc = system(shellCmd); + terminationStatus = system(shellCmd); - exit(rc); + if (WIFSIGNALED(terminationStatus)) + pm_error("Shell process was killed " + "by a Class %u signal.", + WTERMSIG(terminationStatus)); + else if (!WIFEXITED(terminationStatus)) + pm_error("Shell process died, but its termination status " + "0x%x doesn't make sense", terminationStatus); + else + exit(WEXITSTATUS(terminationStatus)); } } } |