diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-12-11 15:23:05 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2021-01-11 12:26:58 -0300 |
commit | 42dda89dcb0407f6799dbfd0b9dab1529666ad51 (patch) | |
tree | 895e367e9d4cd02a94205bf63e6387c6f05af7f1 /sysdeps | |
parent | 7b9c3260bcca73781dda6bc2ddee84869bedfb8c (diff) | |
download | glibc-42dda89dcb0407f6799dbfd0b9dab1529666ad51.tar glibc-42dda89dcb0407f6799dbfd0b9dab1529666ad51.tar.gz glibc-42dda89dcb0407f6799dbfd0b9dab1529666ad51.tar.bz2 glibc-42dda89dcb0407f6799dbfd0b9dab1529666ad51.zip |
posix: Fix return value of system if shell can not be executed [BZ #27053]
POSIX states that system returned code for failure to execute the shell
shall be as if the shell had terminated using _exit(127). This
behaviour was removed with 5fb7fc96350575.
Checked on x86_64-linux-gnu.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/posix/system.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c index e53ec5f977..13c0662f90 100644 --- a/sysdeps/posix/system.c +++ b/sysdeps/posix/system.c @@ -175,6 +175,10 @@ do_system (const char *line) __libc_cleanup_region_end (0); #endif } + else + /* POSIX states that failure to execute the shell should return + as if the shell had terminated using _exit(127). */ + status = W_EXITCODE (127, 0); DO_LOCK (); if (SUB_REF () == 0) |