summaryrefslogtreecommitdiff
path: root/lib/posixtm.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-04-09 13:28:25 +0000
committerJim Meyering <jim@meyering.net>2005-04-09 13:28:25 +0000
commit5fb6300448c33d2d0099c426f437e795c925f4ca (patch)
tree8b026e04c7276cf5e8135e8d4fac931d24ebec86 /lib/posixtm.c
parent71984394f3526df84af4c50be65bbf4a66ad8394 (diff)
downloadcoreutils-5fb6300448c33d2d0099c426f437e795c925f4ca.tar.xz
(posixtime) [lint]: Avoid spurious warning from gcc-4's
-Wuninitialized: initialize tm0.tm_year.
Diffstat (limited to 'lib/posixtm.c')
-rw-r--r--lib/posixtm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/posixtm.c b/lib/posixtm.c
index 1400e5a51..402d59a1b 100644
--- a/lib/posixtm.c
+++ b/lib/posixtm.c
@@ -1,6 +1,6 @@
/* Parse dates for touch and date.
- Copyright (C) 1989, 1990, 1991, 1998, 2000, 2001, 2002, 2003, 2004
+ Copyright (C) 1989, 1990, 1991, 1998, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation Inc.
This program is free software; you can redistribute it and/or modify
@@ -198,6 +198,14 @@ posixtime (time_t *p, const char *s, unsigned int syntax_bits)
struct tm const *tm;
time_t t;
+#ifdef lint
+ /* Placate gcc-4's -Wuninitialized.
+ posix_time_parse fails to set tm0.tm_year only when it returns
+ nonzero (due to year() returning nonzero), and in that case,
+ this code doesn't use the tm0 at all. */
+ tm0.tm_year = 0;
+#endif
+
if (posix_time_parse (&tm0, s, syntax_bits))
return false;