more errno cleanup

This commit is contained in:
tg 2007-06-06 23:41:24 +00:00
parent 3dcf22a319
commit 81014fa81b
2 changed files with 8 additions and 6 deletions

View File

@ -5,7 +5,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.56 2007/06/06 23:28:15 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.57 2007/06/06 23:41:23 tg Exp $");
int
c_cd(const char **wp)
@ -3008,11 +3008,12 @@ c_ulimit(const char **wp)
if (how & HARD)
limit.rlim_max = val;
if (setrlimit(l->scmd, &limit) < 0) {
if (errno == EPERM)
how = errno;
if (how == EPERM)
bi_errorf("exceeds allowable limit");
else
bi_errorf("bad limit: %s",
strerror(errno));
strerror(how));
return 1;
}
} else {

5
jobs.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.23 2007/06/06 23:28:15 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.24 2007/06/06 23:41:24 tg Exp $");
/* Order important! */
#define PRUNNING 0
@ -649,6 +649,7 @@ j_resume(const char *cp, int bg)
if (ttypgrp_ok &&
tcsetpgrp(tty_fd, (j->flags & JF_SAVEDTTYPGRP) ?
j->saved_ttypgrp : j->pgrp) < 0) {
rv = errno;
if (j->flags & JF_SAVEDTTY)
tcsetattr(tty_fd, TCSADRAIN, &tty_state);
sigprocmask(SIG_SETMASK, &omask,
@ -657,7 +658,7 @@ j_resume(const char *cp, int bg)
tty_fd,
(int) ((j->flags & JF_SAVEDTTYPGRP) ?
j->saved_ttypgrp : j->pgrp),
strerror(errno));
strerror(rv));
return 1;
}
}