summaryrefslogtreecommitdiffstats
path: root/term-utils/agetty.c
diff options
context:
space:
mode:
authorKarel Zak2012-02-06 16:02:28 +0100
committerKarel Zak2012-02-06 16:02:28 +0100
commitd9201203cff43408228c2e26c051012db9821450 (patch)
tree73d5923eb0eda56baec4d4937eec2921ebcca3bc /term-utils/agetty.c
parentlogin: fix leak, improve strtok usage (diff)
downloadkernel-qcow2-util-linux-d9201203cff43408228c2e26c051012db9821450.tar.gz
kernel-qcow2-util-linux-d9201203cff43408228c2e26c051012db9821450.tar.xz
kernel-qcow2-util-linux-d9201203cff43408228c2e26c051012db9821450.zip
agetty: check localtime() result
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils/agetty.c')
-rw-r--r--term-utils/agetty.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index ffdfb31c7..d9c9b05b3 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -1819,6 +1819,9 @@ static void output_special_char(unsigned char c, struct options *op,
time(&now);
tm = localtime(&now);
+ if (!tm)
+ break;
+
if (c == 'd') /* ISO 8601 */
printf("%s %s %d %d",
nl_langinfo(ABDAY_1 + tm->tm_wday),