lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* Note: we disable this on uClibc because we dont bother |
| 2 | * verifying if the year is sane ... we just return ???? |
| 3 | * for the year value ... |
| 4 | */ |
| 5 | |
| 6 | #include <errno.h> |
| 7 | #include <limits.h> |
| 8 | #include <stdio.h> |
| 9 | #include <time.h> |
| 10 | |
| 11 | |
| 12 | static int |
| 13 | do_test (void) |
| 14 | { |
| 15 | int result = 0; |
| 16 | time_t t = time (NULL); |
| 17 | struct tm *tp = localtime (&t); |
| 18 | tp->tm_year = 10000 - 1900; |
| 19 | char buf[1000]; |
| 20 | errno = 0; |
| 21 | buf[26] = '\xff'; |
| 22 | char *s = asctime_r (tp, buf); |
| 23 | if (s != NULL || errno != EOVERFLOW) |
| 24 | { |
| 25 | puts ("asctime_r did not fail correctly"); |
| 26 | result = 1; |
| 27 | } |
| 28 | if (buf[26] != '\xff') |
| 29 | { |
| 30 | puts ("asctime_r overwrote 27th byte in buffer"); |
| 31 | result = 1; |
| 32 | } |
| 33 | return result; |
| 34 | } |
| 35 | |
| 36 | #define TEST_FUNCTION do_test () |
| 37 | #include "../test-skeleton.c" |