summaryrefslogtreecommitdiff
path: root/src/faillog.c
diff options
context:
space:
mode:
authorBalint Reczey <balint@balintreczey.hu>2021-11-07 15:18:49 +0100
committerBalint Reczey <balint@balintreczey.hu>2021-11-07 15:18:49 +0100
commit749c1780621163ca5108f164861324bafa9e0ae8 (patch)
tree51001872624a692018c45bf39276df94b603fb19 /src/faillog.c
parentd906ecd3b652d95af6ffb974a2f6669501bb9496 (diff)
downloadshadow-749c1780621163ca5108f164861324bafa9e0ae8.tar.gz
New upstream version 4.9upstream/4.9
Diffstat (limited to 'src/faillog.c')
-rw-r--r--src/faillog.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/faillog.c b/src/faillog.c
index 1309dad4..d09f1511 100644
--- a/src/faillog.c
+++ b/src/faillog.c
@@ -62,6 +62,7 @@ static void reset (void);
* Global variables
*/
const char *Prog; /* Program name */
+FILE *shadow_logfd = NULL;
static FILE *fail; /* failure file stream */
static time_t seconds; /* that number of days in seconds */
static unsigned long umin; /* if uflg and has_umin, only display users with uid >= umin */
@@ -163,6 +164,10 @@ static void print_one (/*@null@*/const struct passwd *pw, bool force)
}
tm = localtime (&fl.fail_time);
+ if (!tm) {
+ fprintf (stderr, "Cannot read time from faillog.\n");
+ return;
+ }
#ifdef HAVE_STRFTIME
strftime (ptime, sizeof (ptime), "%D %H:%M:%S %z", tm);
cp = ptime;
@@ -569,6 +574,7 @@ int main (int argc, char **argv)
* most error messages.
*/
Prog = Basename (argv[0]);
+ shadow_logfd = stderr;
(void) setlocale (LC_ALL, "");
(void) bindtextdomain (PACKAGE, LOCALEDIR);