Merge remote-tracking branch 'mksh/master'

This commit is contained in:
KO Myung-Hun
2016-06-29 08:17:29 +09:00
10 changed files with 361 additions and 182 deletions

39
funcs.c
View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.295 2016/02/26 20:56:43 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.297 2016/06/26 00:44:25 tg Exp $");
#if HAVE_KILLPG
/*
@ -2004,20 +2004,20 @@ c_read(const char **wp)
}
#endif
bytesread = blocking_read(fd, xp, bytesleft);
if (bytesread == (size_t)-1) {
/* interrupted */
if (errno == EINTR && fatal_trap_check()) {
/*
* Was the offending signal one that would
* normally kill a process? If so, pretend
* the read was killed.
*/
rv = 2;
goto c_read_out;
if ((bytesread = blocking_read(fd, xp, bytesleft)) == (size_t)-1) {
if (errno == EINTR) {
/* check whether the signal would normally kill */
if (!fatal_trap_check()) {
/* no, just ignore the signal */
goto c_read_readloop;
}
/* pretend the read was killed */
} else {
/* unexpected error */
bi_errorf("%s", cstrerror(errno));
}
/* just ignore the signal */
goto c_read_readloop;
rv = 2;
goto c_read_out;
}
c_read_didread:
@ -2855,6 +2855,7 @@ c_test(const char **wp)
int argc, rv, invert = 0;
Test_env te;
Test_op op;
Test_meta tm;
const char *lhs, **swp;
te.flags = 0;
@ -2915,6 +2916,16 @@ c_test(const char **wp)
rv = test_eval(&te, op, lhs, *te.pos.wp++, true);
goto ptest_out;
}
if (ptest_isa(&te, tm = TM_AND) || ptest_isa(&te, tm = TM_OR)) {
/* XSI */
argc = test_eval(&te, TO_STNZE, lhs, NULL, true);
rv = test_eval(&te, TO_STNZE, *te.pos.wp++, NULL, true);
if (tm == TM_AND)
rv = argc && rv;
else
rv = argc || rv;
goto ptest_out;
}
/* back up to lhs */
te.pos.wp = swp;
if (ptest_isa(&te, TM_NOT)) {