BeOS has no tty nor uid/gid other than 0, a̲n̲d̲ a broken /bin/sh

This commit is contained in:
tg 2012-04-01 16:55:16 +00:00
parent 412a96d29a
commit c30bf73a56
2 changed files with 22 additions and 5 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.533 2012/04/01 16:40:26 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.534 2012/04/01 16:55:15 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
@ -457,7 +457,17 @@ AIX)
: ${HAVE_SETLOCALE_CTYPE=0}
;;
BeOS)
oswarn="; it has some issues"
case $KSH_VERSION in
*MIRBSD\ KSH*)
oswarn="; it has minor issues"
;;
*)
oswarn="; you must recompile mksh with"
oswarn="$oswarn${nl}itself in a second stage"
;;
esac
# BeOS has no real tty either
add_cppflags -DMKSH_UNEMPLOYED
;;
BSD/OS)
: ${HAVE_SETLOCALE_CTYPE=0}
@ -1361,7 +1371,7 @@ else
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.533 2012/04/01 16:40:26 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.534 2012/04/01 16:55:15 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); }
EOF
case $cm in

11
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.185 2012/03/26 20:04:05 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.186 2012/04/01 16:55:16 tg Exp $");
/* type bits for unsigned char */
unsigned char chtypes[UCHAR_MAX + 1];
@ -250,9 +250,16 @@ change_flag(enum sh_flag f, int what, unsigned int newval)
DO_SETUID(setresuid, (ksheuid, ksheuid, ksheuid));
#else
/* seteuid, setegid, setgid don't EAGAIN on Linux */
seteuid(ksheuid = kshuid = getuid());
ksheuid = kshuid = getuid();
#ifndef __BEOS__
/* BeOS doesn't have different UIDs */
seteuid(ksheuid);
#endif
DO_SETUID(setuid, (ksheuid));
#ifndef __BEOS__
/* BeOS doesn't have different GIDs */
setegid(kshegid);
#endif
setgid(kshegid);
#endif
} else if ((f == FPOSIX || f == FSH) && newval) {