aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-05-22 19:34:45 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-05-22 19:34:45 +0200
commitf5470419404d643070db99d058405b714695b817 (patch)
tree7ed502471976679437b86f2e2cb38c14984f8a1e /shell/ash.c
parent0c63299b84513ff995413f820cb5f3d546c0c5d7 (diff)
downloadbusybox-w32-f5470419404d643070db99d058405b714695b817.tar.gz
busybox-w32-f5470419404d643070db99d058405b714695b817.tar.bz2
busybox-w32-f5470419404d643070db99d058405b714695b817.zip
ash,hush: fix SIGCHLD interrupting read builtin
function old new delta readcmd 169 217 +48 shell_builtin_read 1087 1097 +10 localcmd 366 364 -2 builtin_read 197 193 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 58/-6) Total: 52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 70ee15ed8..60c8ffeb7 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13268,6 +13268,7 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
13268 /* "read -s" needs to save/restore termios, can't allow ^C 13268 /* "read -s" needs to save/restore termios, can't allow ^C
13269 * to jump out of it. 13269 * to jump out of it.
13270 */ 13270 */
13271 again:
13271 INT_OFF; 13272 INT_OFF;
13272 r = shell_builtin_read(setvar0, 13273 r = shell_builtin_read(setvar0,
13273 argptr, 13274 argptr,
@@ -13280,6 +13281,12 @@ readcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
13280 ); 13281 );
13281 INT_ON; 13282 INT_ON;
13282 13283
13284 if ((uintptr_t)r == 1 && errno == EINTR) {
13285 /* to get SIGCHLD: sleep 1 & read x; echo $x */
13286 if (pending_sig == 0)
13287 goto again;
13288 }
13289
13283 if ((uintptr_t)r > 1) 13290 if ((uintptr_t)r > 1)
13284 ash_msg_and_raise_error(r); 13291 ash_msg_and_raise_error(r);
13285 13292