now opens log file with mode 077

This commit is contained in:
Todd C. Miller
1994-02-28 01:55:35 +00:00
parent 35bc172d3c
commit 75e0a9c4a7

View File

@@ -72,6 +72,7 @@ void log_error(code)
char cwd[MAXPATHLEN + 1]; char cwd[MAXPATHLEN + 1];
int argc; int argc;
char **argv; char **argv;
mode_t oldmask;
register char *p; register char *p;
register int count; register int count;
#ifndef SYSLOG #ifndef SYSLOG
@@ -266,7 +267,10 @@ void log_error(code)
/* become root */ /* become root */
be_root(); be_root();
if ((fp = fopen(LOGFILE, "a")) == NULL) { oldmask = umask(077);
fp = fopen(LOGFILE, "a");
(void) umask(oldmask);
if (fp == NULL) {
(void) sprintf(logline, "Can\'t open log file: %s", LOGFILE); (void) sprintf(logline, "Can\'t open log file: %s", LOGFILE);
send_mail(); send_mail();
} else { } else {