X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmisc%2Fwordexp.c;h=db83a69f37d996aa2a9f61bde18a60c06a727505;hb=4f893997e4738faf6dde8320b304298340f51cd2;hp=db39b5b8a3e3dee78bf6a54c1af3a1e23013c72b;hpb=594ffed82f4e6ee7da85e9c5da35e32946ae32c9;p=musl diff --git a/src/misc/wordexp.c b/src/misc/wordexp.c index db39b5b8..db83a69f 100644 --- a/src/misc/wordexp.c +++ b/src/misc/wordexp.c @@ -14,13 +14,7 @@ static void reap(pid_t pid) { int status; - for (;;) { - if (waitpid(pid, &status, 0) < 0) { - if (errno != EINTR) return; - } else { - if (WIFEXITED(status)) return; - } - } + while (waitpid(pid, &status, 0) < 0 && errno == EINTR); } static char *getword(FILE *f) @@ -48,7 +42,7 @@ static int do_wordexp(const char *s, wordexp_t *we, int flags) if (flags & WRDE_NOCMD) for (i=0; s[i]; i++) switch (s[i]) { case '\\': - if (!sq) i++; + if (!sq && !s[++i]) return WRDE_SYNTAX; break; case '\'': if (!dq) sq^=1;