]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/test/time/bug-asctime.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / test / time / bug-asctime.c
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 = 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"