Security fix.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14004 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-07-02 14:20:32 +00:00
parent b697f0fdad
commit 13f48a05f7
2 changed files with 21 additions and 2 deletions

View file

@ -4466,7 +4466,7 @@ printf(
}
}
if (pidfile) {
if (pidfile)
{
FILE *fptr = fopen(pidfile, "at");
@ -4479,7 +4479,6 @@ printf(
fprintf(fptr, "%d\n", (int) getpid());
fclose(fptr);
}
}
/*
* Ensure we don't have any open file descriptors which may refer
@ -4574,6 +4573,21 @@ printf(
setuid (uid);
}
#endif /* __MINGW__ */
if (pidfile)
{
FILE *fptr = fopen(pidfile, "at");
if (fptr == 0)
{
sprintf(ebuf, "Unable to open pid file - '%s'", pidfile);
gdomap_log(LOG_CRIT);
exit(1);
}
fprintf(fptr, "%d\n", (int) getpid());
fclose(fptr);
}
#if !defined(__svr4__)
/*
* As another level of paranoia - restrict this process to /tmp