svn commit: r272441 - head/lib/libc/stdtime

Pedro F. Giffuni pfg at FreeBSD.org
Thu Oct 2 18:33:59 UTC 2014


Author: pfg
Date: Thu Oct  2 18:33:58 2014
New Revision: 272441
URL: https://svnweb.freebsd.org/changeset/base/272441

Log:
  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

Modified:
  head/lib/libc/stdtime/strptime.c

Modified: head/lib/libc/stdtime/strptime.c
==============================================================================
--- head/lib/libc/stdtime/strptime.c	Thu Oct  2 18:32:30 2014	(r272440)
+++ head/lib/libc/stdtime/strptime.c	Thu Oct  2 18:33:58 2014	(r272441)
@@ -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;
 


More information about the svn-src-head mailing list