diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2014-10-02 18:33:58 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2014-10-02 18:33:58 +0000 |
commit | eff6f4441ac69dd20cff4f3aa2929ebf119dc066 (patch) | |
tree | a447ccce6bfd6a988fd5fdd7b8d55285b7f361a5 /lib/libc/stdtime | |
parent | 8b0569ba8f8836df785a6931a27160bfb07ca5aa (diff) |
strptime: %s format fix.
Almost never needed in real life because %s is tends to be
only one format spec.
1) Return code of gmtime_r() is checked.
2) All flags are set.
Submitted by: ache
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=272441
Diffstat (limited to 'lib/libc/stdtime')
-rw-r--r-- | lib/libc/stdtime/strptime.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index 1d8dad942298..8576bdb3750a 100644 --- a/lib/libc/stdtime/strptime.c +++ b/lib/libc/stdtime/strptime.c @@ -503,8 +503,11 @@ label: } errno = sverrno; buf = cp; - gmtime_r(&t, tm); + if (gmtime_r(&t, tm) == NULL) + return (NULL); *GMTp = 1; + flags |= FLAG_YDAY | FLAG_WDAY | FLAG_MONTH | + FLAG_MDAY | FLAG_YEAR; } break; |