Changeset 4058 for trunk/lib-src/fakemail.c
- Timestamp:
- 04/16/06 21:46:31 (3 years ago)
- Files:
-
- trunk/lib-src/fakemail.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib-src/fakemail.c
r4037 r4058 70 70 #define true 1 71 71 #define false 0 72 73 #define TM_YEAR_BASE 1900 74 75 /* Nonzero if TM_YEAR is a struct tm's tm_year value that causes 76 asctime to have well-defined behavior. */ 77 #ifndef TM_YEAR_IN_ASCTIME_RANGE 78 # define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \ 79 (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) 80 #endif 72 81 73 82 /* Various lists */ … … 355 364 char *the_string, *temp; 356 365 long idiotic_interface; 366 struct tm *tm; 357 367 long prefix_length; 358 368 long user_length; … … 362 372 prefix_length = strlen (FROM_PREFIX); 363 373 time (&idiotic_interface); 364 the_date = ctime (&idiotic_interface); 374 /* Convert to a string, checking for out-of-range time stamps. 375 Don't use 'ctime', as that might dump core if the hardware clock 376 is set to a bizarre value. */ 377 tm = localtime (&idiotic_interface); 378 if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) 379 && (the_date = asctime (tm)))) 380 fatal ("current time is out of range", 0); 365 381 /* the_date has an unwanted newline at the end */ 366 382 date_length = strlen (the_date) - 1;
