diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-07-23 22:11:52 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-07-23 22:11:52 +0300 |
commit | adb5491f2c9f49bf3d0e57f52c55bcaa4221e36e (patch) | |
tree | 4e76b81c1ec485cc10f52d47b699a894cf65a247 /io.c | |
parent | b7a631b6fa5ed5577520eccb1608956bd40a74e0 (diff) | |
parent | de23ab7bfbea6ee03ef7386c6c203a4b2b7b7116 (diff) | |
download | egawk-adb5491f2c9f49bf3d0e57f52c55bcaa4221e36e.tar.gz egawk-adb5491f2c9f49bf3d0e57f52c55bcaa4221e36e.tar.bz2 egawk-adb5491f2c9f49bf3d0e57f52c55bcaa4221e36e.zip |
Merge branch 'master' into feature/nocopy
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1226,7 +1226,8 @@ do_close(int nargs) * POSIX says close() returns 0 on success, non-zero otherwise. * For POSIX, at this point we just return 0. Otherwise we * return the exit status of the process or of pclose(), depending. - * This whole business is a mess. + * Down in the call tree of close_redir(), we rationalize the + * value like we do for system(). */ if (do_posix) { unref(tmp); @@ -1268,13 +1269,14 @@ close_rp(struct redirect *rp, two_way_close_type how) #endif /* HAVE_SOCKETS */ (void) iop_close(rp->iop); } else + /* status already sanitized */ status = gawk_pclose(rp); rp->iop = NULL; } } else if ((rp->flag & (RED_PIPE|RED_WRITE)) == (RED_PIPE|RED_WRITE)) { /* write to pipe */ - status = pclose(rp->output.fp); + status = sanitize_exit_status(pclose(rp->output.fp)); if ((BINMODE & BINMODE_INPUT) != 0) os_setbinmode(fileno(stdin), O_BINARY); @@ -2518,7 +2520,7 @@ gawk_pclose(struct redirect *rp) /* process previously found, return stored status */ if (rp->pid == -1) return rp->status; - rp->status = wait_any(rp->pid); + rp->status = sanitize_exit_status(wait_any(rp->pid)); rp->pid = -1; return rp->status; } |