Przeglądaj źródła

Change strptime so that it only modifies struct tm fields specified.

Manuel Novoa III 20 lat temu
rodzic
commit
9d4c823b84
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      libc/misc/time/time.c

+ 3 - 1
libc/misc/time/time.c

@@ -1406,7 +1406,9 @@ char *__XL(strptime)(const char *__restrict buf, const char *__restrict format,
 
 			i = 0;
 			do {				/* Store the values into tm. */
-				((int *) tm)[i] = fields[i];
+				if (fields[i] != INT_MIN) {
+					((int *) tm)[i] = fields[i];
+				}
 			} while (++i < 8);
 
 			return (char *) buf; /* Success. */