-/* xscreensaver, Copyright (c) 1991-2011 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1991-2012 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
}
+Bool in_signal_handler_p = 0; /* I hate C so much... */
+
char *
timestring (void)
{
- time_t now = time ((time_t *) 0);
- char *str = (char *) ctime (&now);
- char *nl = (char *) strchr (str, '\n');
- if (nl) *nl = 0; /* take off that dang newline */
- return str;
+ if (in_signal_handler_p)
+ {
+ /* Turns out that ctime() and even localtime_r() call malloc() on Linux!
+ So we can't call them from inside SIGCHLD. WTF.
+ */
+ static char buf[30];
+ strcpy (buf, "... ... .. signal ....");
+ return buf;
+ }
+ else
+ {
+ time_t now = time ((time_t *) 0);
+ char *str = (char *) ctime (&now);
+ char *nl = (char *) strchr (str, '\n');
+ if (nl) *nl = 0; /* take off that dang newline */
+ return str;
+ }
}
static Bool blurb_timestamp_p = True; /* kludge */