malloc: Add realloc test.
[glibc.git] / time / bug-asctime_r.c
blob86651ef1c59a96e7bb7fd3b161b92b1d6d4994c3
1 #include <errno.h>
2 #include <limits.h>
3 #include <stdio.h>
4 #include <time.h>
7 static int
8 do_test (void)
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)
20 puts ("asctime_r did not fail correctly");
21 result = 1;
23 if (buf[26] != '\xff')
25 puts ("asctime_r overwrote 27th byte in buffer");
26 result = 1;
28 return result;
31 #define TEST_FUNCTION do_test ()
32 #include "../test-skeleton.c"