lib/, src/: Always pass NULL to time(2)
See time(2):
BUGS
Error returns from this system call are indistinguishable from
successful reports that the time is a few seconds before the
Epoch, so the C library wrapper function never sets errno as a re‐
sult of this call.
The tloc argument is obsolescent and should always be NULL in new
code. When tloc is NULL, the call cannot fail.
Fixes: 45c6603cc8 ("[svn-upgrade] Integrating new upstream version, shadow (19990709)")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
761eb07016
commit
bfb6aad7cb
+2
-2
@@ -82,7 +82,7 @@ void failure (uid_t uid, const char *tty, struct faillog *fl)
|
||||
}
|
||||
|
||||
STRTCPY(fl->fail_line, tty);
|
||||
(void) time (&fl->fail_time);
|
||||
fl->fail_time = time(NULL);
|
||||
|
||||
/*
|
||||
* Seek back to the correct position in the file and write the
|
||||
@@ -126,7 +126,7 @@ static bool too_many_failures (const struct faillog *fl)
|
||||
return true; /* locked until reset manually */
|
||||
}
|
||||
|
||||
(void) time (&now);
|
||||
now = time(NULL);
|
||||
if ((fl->fail_time + fl->fail_locktime) < now) {
|
||||
return false; /* enough time since last failure */
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ void dolastlog (
|
||||
}
|
||||
|
||||
ll_time = newlog.ll_time;
|
||||
(void) time (&ll_time);
|
||||
ll_time = time(NULL);
|
||||
newlog.ll_time = ll_time;
|
||||
STRTCPY(newlog.ll_line, line);
|
||||
#if HAVE_LL_HOST
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ void sulog (const char *tty, bool success, const char *oldname, const char *name
|
||||
return; /* can't open or create logfile */
|
||||
}
|
||||
|
||||
(void) time (&now);
|
||||
now = time(NULL);
|
||||
tm = localtime (&now);
|
||||
|
||||
fprintf (fp, "SU %.02d/%.02d %.02d:%.02d %c %s %s-%s\n",
|
||||
|
||||
Reference in New Issue
Block a user