mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
NetBSD PR#2699: delay revoke of privs until after log file is opened,
and print better diagnostics. Kenneth Stailey <kstailey@dol-esa.gov>
This commit is contained in:
parent
e46025b730
commit
23dccfe411
@ -454,11 +454,13 @@ char *lgetl()
|
||||
lcreat(str)
|
||||
char *str;
|
||||
{
|
||||
extern int errno;
|
||||
lpnt = lpbuf; lpend = lpbuf+BUFBIG;
|
||||
if (str==NULL) return(lfd=1);
|
||||
if ((lfd=creat(str,0644)) < 0)
|
||||
{
|
||||
lfd=1; lprintf("error creating file <%s>\n",str); lflush(); return(-1);
|
||||
lfd=1; lprintf("error (%s) creating file <%s>\n",
|
||||
strerror(errno), str); lflush(); return(-1);
|
||||
}
|
||||
return(lfd);
|
||||
}
|
||||
|
@ -518,13 +518,13 @@ invalid:
|
||||
#ifndef NOLOG
|
||||
if (lappend(logfile)<0) /* append to file */
|
||||
{
|
||||
seteuid(euid);
|
||||
if (lcreat(logfile)<0) /* and can't create new log file */
|
||||
{
|
||||
{
|
||||
lcreat((char*)0);
|
||||
lprcat("\nCan't open record file: I can't post your score.\n");
|
||||
sncbr(); resetscroll(); lflush(); exit();
|
||||
}
|
||||
seteuid(euid);
|
||||
chmod(logfile,0660);
|
||||
seteuid(uid);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user