From 42dda89dcb0407f6799dbfd0b9dab1529666ad51 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 11 Dec 2020 15:23:05 -0300 Subject: 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. --- sysdeps/posix/system.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sysdeps') diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c index e53ec5f..13c0662 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) -- cgit v1.1