From 0cda2e1f8d8222fa497f808b54a2146d60e304f5 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 29 May 2010 09:44:53 +1000 Subject: [BUILTIN] Continue after EINTR in read(1) with no pending signals The recent introduction of SIGCHLD trapping broke read(1) as each SIGCHLD may cause read(1) to return prematurely. Now if we did have a trap for SIGCHLD read(1) should actually do this. However, returning when SIGCHLD isn't trapped is wrong. This patch fixes this by checking for EINTR and pendingsigs in read(1). Signed-off-by: Herbert Xu --- src/miscbltin.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/miscbltin.c b/src/miscbltin.c index 046f2f2..5ab1648 100644 --- a/src/miscbltin.c +++ b/src/miscbltin.c @@ -57,6 +57,7 @@ #include "main.h" #include "expand.h" #include "parser.h" +#include "trap.h" #undef rflag @@ -158,9 +159,16 @@ readcmd(int argc, char **argv) backslash = 0; STARTSTACKSTR(p); for (;;) { - if (read(0, &c, 1) != 1) { - status = 1; + switch (read(0, &c, 1)) { + case 1: break; + default: + if (errno == EINTR && !pendingsigs) + continue; + /* fall through */ + case 0: + status = 1; + goto out; } if (c == '\0') continue; @@ -181,6 +189,7 @@ put: resetbs: backslash = 0; } +out: STACKSTRNUL(p); readcmd_handle_line(stackblock(), ap, p + 1 - (char *)stackblock()); return status; -- cgit 1.4.1 '/src/log/bin/cash/alias.c'>
Commit message (Expand)Author
2019-02-18Match Sh and Ss as Tag in mdocJune McEnroe
2019-02-18Match statics and typedefs as TagJune McEnroe
2019-02-18Clean up htmlHeaderJune McEnroe
2019-02-18Remove hi line numberingJune McEnroe
2019-02-18Add Tag class to hiJune McEnroe
2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe
2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe
2019-02-17Simplify temp trap in upJune McEnroe
2019-02-17Add line numbers to hiJune McEnroe
2019-02-17Always split spans after newlinesJune McEnroe
2019-02-15Color format specifiers light cyan in vimJune McEnroe
2019-02-15Highlight Interp as yellowJune McEnroe
2019-02-15Highlight strings in sh command substitutionsJune McEnroe
2019-02-15Add nmap gpJune McEnroe
2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe
2019-02-13Add forgotten "sixth" book of H2G2June McEnroe