Back to index

glibc  2.9
bug-asctime.c
Go to the documentation of this file.
00001 #include <errno.h>
00002 #include <limits.h>
00003 #include <stdio.h>
00004 #include <time.h>
00005 
00006 
00007 static int
00008 do_test (void)
00009 {
00010   int result = 0;
00011   time_t t = time (NULL);
00012   struct tm *tp = localtime (&t);
00013   tp->tm_year = INT_MAX;
00014   errno = 0;
00015   char *s = asctime (tp);
00016   if (s != NULL || errno != EOVERFLOW)
00017     {
00018       puts ("asctime did not fail correctly");
00019       result = 1;
00020     }
00021   char buf[1000];
00022   errno = 0;
00023   s = asctime_r (tp, buf);
00024   if (s != NULL || errno != EOVERFLOW)
00025     {
00026       puts ("asctime_r did not fail correctly");
00027       result = 1;
00028     }
00029   return result;
00030 }
00031 
00032 #define TEST_FUNCTION do_test ()
00033 #include "../test-skeleton.c"