Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/pw/pw_log.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...) | ||||
char nfmt[256], sname[32]; | char nfmt[256], sname[32]; | ||||
if (cnf->logfile == NULL || cnf->logfile[0] == '\0') { | if (cnf->logfile == NULL || cnf->logfile[0] == '\0') { | ||||
return; | return; | ||||
} | } | ||||
if (logfile == NULL) { | if (logfile == NULL) { | ||||
/* With umask==0 we need to control file access modes on create */ | /* With umask==0 we need to control file access modes on create */ | ||||
fd = open(cnf->logfile, O_WRONLY | O_CREAT | O_APPEND, 0600); | fd = open(cnf->logfile, O_WRONLY | O_CREAT | O_APPEND, cnf->logmode); | ||||
if (fd == -1) { | if (fd == -1) { | ||||
return; | return; | ||||
} | } | ||||
logfile = fdopen(fd, "a"); | logfile = fdopen(fd, "a"); | ||||
if (logfile == NULL) { | if (logfile == NULL) { | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |