diff options
author | Ron Yorston <rmy@pobox.com> | 2023-09-14 08:09:14 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-09-14 08:09:14 +0100 |
commit | 0475b7a649209487269e35cbe49662a33524e6ae (patch) | |
tree | 531237e1d8716e7c94fdcd0b2966e2e0cbfc0255 /loginutils/suw32.c | |
parent | e3d50157ce21f990c33afdcf8dba8080308ce0f0 (diff) | |
download | busybox-w32-0475b7a649209487269e35cbe49662a33524e6ae.tar.gz busybox-w32-0475b7a649209487269e35cbe49662a33524e6ae.tar.bz2 busybox-w32-0475b7a649209487269e35cbe49662a33524e6ae.zip |
win32: convert exit codes
Add two utility functions to convert Windows process exit codes.
- exit_code_to_wait_status() converts to a POSIX wait status.
This is used in ash and the implementations of system(3) and
mingw_wait3().
- exit_code_to_posix() converts to a POSIX exit code. (Not that
POSIX has much to say about them.)
As a result it's possible for more applets to report when child
processes are killed as if by a signal. 'time', 'drop' and 'su -W',
for example.
Adds 64-80 bytes.
Diffstat (limited to 'loginutils/suw32.c')
-rw-r--r-- | loginutils/suw32.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/loginutils/suw32.c b/loginutils/suw32.c index 79e8415a8..240a692bc 100644 --- a/loginutils/suw32.c +++ b/loginutils/suw32.c | |||
@@ -112,6 +112,8 @@ int suw32_main(int argc UNUSED_PARAM, char **argv) | |||
112 | WaitForSingleObject(info.hProcess, INFINITE); | 112 | WaitForSingleObject(info.hProcess, INFINITE); |
113 | if (!GetExitCodeProcess(info.hProcess, &r)) | 113 | if (!GetExitCodeProcess(info.hProcess, &r)) |
114 | r = 1; | 114 | r = 1; |
115 | else | ||
116 | r = exit_code_to_posix(r); | ||
115 | CloseHandle(info.hProcess); | 117 | CloseHandle(info.hProcess); |
116 | return r; | 118 | return r; |
117 | } | 119 | } |