diff options
author | pfg <pfg@FreeBSD.org> | 2014-10-02 18:33:58 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-10-02 18:33:58 +0000 |
commit | 9c6d66adef3f5d75b65c9a991183859ac567984d (patch) | |
tree | a447ccce6bfd6a988fd5fdd7b8d55285b7f361a5 | |
parent | 223886f22f4cd1c9210b299ae0738b6016c5d662 (diff) | |
download | FreeBSD-src-9c6d66adef3f5d75b65c9a991183859ac567984d.zip FreeBSD-src-9c6d66adef3f5d75b65c9a991183859ac567984d.tar.gz |
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
-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 1d8dad9..8576bdb 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; |