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

source code of glibc/time/bug-asctime.c