diff options
author | wosch <wosch@FreeBSD.org> | 1997-02-08 22:36:11 +0000 |
---|---|---|
committer | wosch <wosch@FreeBSD.org> | 1997-02-08 22:36:11 +0000 |
commit | 865b89e27e59d29eda6c8ee5740aec88a26668c0 (patch) | |
tree | b8c1d3cd5f261b56672e117a7754ac81cc16e074 /gnu | |
parent | 775171eb81e8ca93a836c9d20fabe64535f4ec63 (diff) | |
download | FreeBSD-src-865b89e27e59d29eda6c8ee5740aec88a26668c0.zip FreeBSD-src-865b89e27e59d29eda6c8ee5740aec88a26668c0.tar.gz |
Check return value from system() function.
Pointed out some months ago by: Bruce
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/man/lib/util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gnu/usr.bin/man/lib/util.c b/gnu/usr.bin/man/lib/util.c index 6db023b..995d318 100644 --- a/gnu/usr.bin/man/lib/util.c +++ b/gnu/usr.bin/man/lib/util.c @@ -139,6 +139,16 @@ do_system_command (command) else status = system (command); + /* check return value from system() function first */ + if (status == -1) { + fprintf(stderr, + "wait() for exit status of shell failed in function system()\n"); + return 0; + } else if (status == 127 || status == (127 << 8)) { + fprintf(stderr, "execution of the shell failed in function system()\n"); + return 0; + } + if (WIFSIGNALED(status)) return -1; else if (WEXITSTATUS(status)) { |