Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Oct 2014 18:33:58 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272441 - head/lib/libc/stdtime
Message-ID:  <201410021833.s92IXwr6031863@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410021833.s92IXwr6031863>