1 #include <errno.h> 2 #include <limits.h> 3 #include <stdio.h> 4 #include <time.h> 5 6 7 static int do_test(void)8do_test (void) 9 { 10 int result = 0; 11 time_t t = time (NULL); 12 struct tm *tp = localtime (&t); 13 tp->tm_year = 10000 - 1900; 14 char buf[1000]; 15 errno = 0; 16 buf[26] = '\xff'; 17 char *s = asctime_r (tp, buf); 18 if (s != NULL || errno != EOVERFLOW) 19 { 20 puts ("asctime_r did not fail correctly"); 21 result = 1; 22 } 23 if (buf[26] != '\xff') 24 { 25 puts ("asctime_r overwrote 27th byte in buffer"); 26 result = 1; 27 } 28 return result; 29 } 30 31 #define TEST_FUNCTION do_test () 32 #include "../test-skeleton.c" 33