• bring back automatic turn-on of FPOSIX if called as sh/-sh
‣ only if !MKSH_SMALL ‣ add appropriate regression test • if FPOSIX is set, do not close fds > 2 on exec, Debian #499139 • add appropriate regression tests for keeping fds private or not
This commit is contained in:
17
main.c
17
main.c
@ -13,7 +13,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.101 2008/07/10 18:34:08 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.102 2008/09/17 19:31:29 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -173,6 +173,21 @@ main(int argc, const char *argv[])
|
||||
Flag(FVITABCOMPLETE) = 1;
|
||||
#endif
|
||||
|
||||
#ifndef MKSH_SMALL
|
||||
/* Set FPOSIX if we're called as -sh or /bin/sh or so */
|
||||
{
|
||||
const char *cc;
|
||||
|
||||
cc = kshname;
|
||||
i = 0; argi = 0;
|
||||
while (cc[i] != '\0')
|
||||
if ((cc[i++] | 2) == '/')
|
||||
argi = i;
|
||||
if (((cc[argi] | 0x20) == 's') && ((cc[argi + 1] | 0x20) == 'h'))
|
||||
change_flag(FPOSIX, OF_FIRSTTIME, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* import environment */
|
||||
if (environ != NULL)
|
||||
for (wp = (const char **)environ; *wp != NULL; wp++)
|
||||
|
Reference in New Issue
Block a user