libc: system should return WEXITSTATUS(status)

This commit is contained in:
K. Lange 2018-11-05 13:51:29 +09:00
parent 79ad8dbb79
commit 6bde148d27
1 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <wait.h>
#include <sys/types.h>
#include <sys/wait.h>
int system(const char * command) {
char * args[] = {
@ -17,6 +18,6 @@ int system(const char * command) {
} else {
int status;
waitpid(pid, &status, 0);
return status;
return WEXITSTATUS(status);
}
}