while here, change SETUID_CAN_FAIL_WITH_EAGAIN to abort immediately

by suggestion of Chris Palmer again
This commit is contained in:
tg 2010-09-19 19:28:23 +00:00
parent b0b03a5a75
commit e169648b89
3 changed files with 8 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.393 2010/09/15 21:08:16 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.394 2010/09/19 19:28:21 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -25,7 +25,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R39 2010/09/15
@(#)MIRBSD KSH R39 2010/09/19
description:
Check version of shell.
stdin:

16
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.147 2010/09/14 21:26:15 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.148 2010/09/19 19:28:22 tg Exp $");
unsigned char chtypes[UCHAR_MAX + 1]; /* type bits for unsigned char */
@ -48,17 +48,9 @@ static void chvt(const char *);
#ifdef SETUID_CAN_FAIL_WITH_EAGAIN
/* we don't need to check for other codes, EPERM won't happen */
#define DO_SETUID(func, argvec) do { \
bool messaged = false; \
\
while (/* CONSTCOND */ 1) \
if (!(func argvec) || errno != EAGAIN) \
break; \
else if (!messaged) { \
warningf(true, "%s failed with EAGAIN," \
" probably due to a too low process" \
" limit; retrying infinitely", #func); \
messaged = true; \
} \
if ((func argvec) && errno == EAGAIN) \
errorf("%s failed with EAGAIN, probably due to a" \
" too low process limit; aborting", #func); \
} while (/* CONSTCOND */ 0)
#else
#define DO_SETUID(func, argvec) func argvec

4
sh.h
View File

@ -154,9 +154,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.415 2010/09/15 21:08:19 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.416 2010/09/19 19:28:23 tg Exp $");
#endif
#define MKSH_VERSION "R39 2010/09/15"
#define MKSH_VERSION "R39 2010/09/19"
#ifndef MKSH_INCLUDES_ONLY