diff options
| author | Randy Palamar <palamar@ualberta.ca> | 2023-10-10 20:55:56 -0600 |
|---|---|---|
| committer | Randy Palamar <palamar@ualberta.ca> | 2023-10-10 21:39:46 -0600 |
| commit | aa18162e2d62d1a4a618ee65289ba8b1cdeaf29a (patch) | |
| tree | 156b6d589f031633743640ed7ff6c8ecb7573c6e | |
| parent | d7cd42e6b7a5b3207a5365fa8c06c14cb4ce1d51 (diff) | |
| download | vis-aa18162e2d62d1a4a618ee65289ba8b1cdeaf29a.tar.gz vis-aa18162e2d62d1a4a618ee65289ba8b1cdeaf29a.tar.xz | |
vis_pipe: correctly return non-zero exit status
according to POSIX wait(3p) the return status needs to be checked
and the macro WEXITSTATUS(stat_val) should be used to get the actual
return value on a normal exit. POSIX doesn't specify the value of
stat_val on abnormal exit and thus vis_pipe() should just return
-1 as it does for other errors
closes #1130: vis:pipe returns wrong exit status (when non-zero)
Thanks @pippi1otta for the report and suggestion.
| -rw-r--r-- | vis.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1960,7 +1960,10 @@ err: vis->interrupted = false; vis->ui->terminal_restore(vis->ui); - return status; + if (WIFEXITED(status)) + return WEXITSTATUS(status); + + return -1; } static ssize_t read_buffer(void *context, char *data, size_t len) { |
