blob: 149e4e0a28782bffe8b0b7f48f8b1e1cbcf87e91 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* 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
12static int
13do_test (void)
14{
15 int result = 0;
16 time_t t = time (NULL);
17 struct tm *tp = localtime (&t);
18 tp->tm_year = INT_MAX;
19 errno = 0;
20 char *s = asctime (tp);
21 if (s != NULL || errno != EOVERFLOW)
22 {
23 printf ("asctime did not fail correctly: s=%p, wanted %p; errno=%i, wanted %i\n",
24 s, NULL, errno, EOVERFLOW);
25 result = 1;
26 }
27 char buf[1000];
28 errno = 0;
29 s = asctime_r (tp, buf);
30 if (s != NULL || errno != EOVERFLOW)
31 {
32 printf ("asctime_r did not fail correctly: s=%p, wanted %p; errno=%i, wanted %i\n",
33 s, NULL, errno, EOVERFLOW);
34 result = 1;
35 }
36 return result;
37}
38
39#define TEST_FUNCTION do_test ()
40#include "../test-skeleton.c"