From 82dec6932ed868d9466d23ac5956e09594707dd2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 7 Apr 2016 19:43:07 +0300 Subject: Fix the MinGW compilation. --- builtin.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index a1c09d5a..8aee1177 100644 --- a/builtin.c +++ b/builtin.c @@ -2101,7 +2101,11 @@ do_system(int nargs) if (do_posix) ; /* leave it alone, full 16 bits */ else if (do_traditional) +#ifdef __MINGW32__ + ret = (((unsigned)status) & ~0xC0000000); +#else ret = (status / 256.0); +#endif else if (WIFEXITED(status)) ret = WEXITSTATUS(status); /* normal exit */ else if (WIFSIGNALED(status)) { -- cgit v1.2.3 From 658ede8ca657fe56c7ea6b0a3a1bd89fb858d26d Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 7 Apr 2016 21:46:44 +0300 Subject: Fix race condition in fatal errors for one end closed on two way pipe. --- builtin.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index 8aee1177..108bcb89 100644 --- a/builtin.c +++ b/builtin.c @@ -1669,6 +1669,7 @@ do_printf(int nargs, int redirtype) rp = redirect(redir_exp, redirtype, & errflg); if (rp != NULL) { if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == NULL) { + (void) close_rp(rp, CLOSE_ALL); fatal(_("printf: attempt to write to closed write end of two-way pipe")); } fp = rp->output.fp; @@ -2149,6 +2150,7 @@ do_print(int nargs, int redirtype) rp = redirect(redir_exp, redirtype, & errflg); if (rp != NULL) { if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == NULL) { + (void) close_rp(rp, CLOSE_ALL); fatal(_("print: attempt to write to closed write end of two-way pipe")); } fp = rp->output.fp; @@ -2217,6 +2219,7 @@ do_print_rec(int nargs, int redirtype) rp = redirect(redir_exp, redirtype, & errflg); if (rp != NULL) { if ((rp->flag & RED_TWOWAY) != 0 && rp->output.fp == NULL) { + (void) close_rp(rp, CLOSE_ALL); fatal(_("print: attempt to write to closed write end of two-way pipe")); } fp = rp->output.fp; -- cgit v1.2.3