The %s format in strptime doesn't work.  The problem is that the number
of seconds is not initialized to zero before conversion.

=======================================================================
--- glibc-2.0.111/time/strptime.c.orig  Tue Dec 15 16:34:48 1998
+++ glibc-2.0.111/time/strptime.c       Wed Jan 27 02:04:28 1999
@@ -537,7 +537,7 @@
               the `get_number' macro.  Instead read the number
               character for character and construct the result while
               doing this.  */
-           time_t secs;
+           time_t secs = 0;
            if (*rp < '0' || *rp > '9')
              /* We need at least one digit.  */
              return NULL;
=======================================================================

The info description of strptime is somewhat misleading.  It should state
clearly that NULL is returned if the format is not completely matched.
(The code example does show this.)

>From the Open Group's Single UNIX Specification:

RETURN VALUE
Upon successful completion, strptime() returns a pointer to the character
following the last character parsed.  Otherwise, a null pointer is returned.

-- 
B. D. Elliott   [EMAIL PROTECTED]   (Seattle)

Reply via email to