Minor tidyup

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9774 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-05-04 04:48:59 +00:00
parent f61bd6a6f6
commit d54b4c979a
2 changed files with 16 additions and 1 deletions

View file

@ -3,6 +3,7 @@
* Source/NSDate.m: GSTimeNow() remove volatile typespec and move
initialisation of interval in the hope of fixing a problem with
float operations. In any case, the code is tidier.
* Tools/gdomap.c: If started as root, try to become user nobody.
2001-05-03 Adam Fedor <fedor@gnu.org>

View file

@ -4222,11 +4222,25 @@ printf(
*/
if (getuid () != 0)
{
/*
* Try to be the user who launched us ... so they can kill us too.
*/
setuid (getuid ());
}
else
{
setuid (-1);
int uid = -1;
#ifdef HAVE_PWD
#ifdef HAVE_GETPWNAM
struct passwd *pw = getpwnam("nobody");
if (pw != 0)
{
uid = pw->pw_uid;
}
#endif
#endif
setuid (uid);
}
#endif /* __MINGW__ */
#if !defined(__svr4__)