* libmisc/sulog.c: Ignore the return value of umask() when the

mask is restored.
	* libmisc/sulog.c: Add brackets.
	* libmisc/sulog.c: Ignore return value of time() when use with a
	non NULL argument.
This commit is contained in:
nekral-guest 2008-06-13 19:52:58 +00:00
parent fe0e4f635e
commit 07a6bcaa77
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2008-06-13 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/sulog.c: Ignore the return value of umask() when the
mask is restored.
* libmisc/sulog.c: Add brackets.
* libmisc/sulog.c: Ignore return value of time() when use with a
non NULL argument.
2008-06-13 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/log.c: Avoid assignments in comparisons.

View File

@ -76,7 +76,7 @@ void sulog (const char *tty, bool success, const char *oldname, const char *name
oldgid = 0;
}
fp = fopen (sulog_file, "a+");
umask (oldmask);
(void) umask (oldmask);
if ((oldgid != 0) && (setgid (oldgid) != 0)) {
perror ("setgid");
SYSLOG ((LOG_ERR,
@ -85,10 +85,11 @@ void sulog (const char *tty, bool success, const char *oldname, const char *name
/* Do not return if the group permission were raised. */
exit (1);
}
if (fp == (FILE *) 0)
if (fp == (FILE *) 0) {
return; /* can't open or create logfile */
}
time (&now);
(void) time (&now);
tm = localtime (&now);
fprintf (fp, "SU %.02d/%.02d %.02d:%.02d %c %s %s-%s\n",