Check return value from system() function.

Pointed out some months ago by: Bruce
This commit is contained in:
Wolfram Schneider 1997-02-08 22:36:11 +00:00
parent 557330ca5f
commit a98e5d2939
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=22440

View File

@ -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)) {