This is the mail archive of the
cygwin
mailing list for the Cygwin project.
localtime_r segfaults, localtime doesn't... same values passed to each function...
- From: Brian Bisaillon <brian_bisaillon at rogers dot com>
- To: cygwin at cygwin dot com
- Date: Sun, 10 Jul 2005 17:06:12 -0400 (EDT)
- Subject: localtime_r segfaults, localtime doesn't... same values passed to each function...
This works...
struct tm *sci_localtime (time_t timep) {
struct tm *result;
if ((result = localtime(&timep)) == NULL) {
int errsv = errno;
fprintf (stderr, "\nError Code %i: %s at line
%i of %s function in %s \
\n", strerror (errsv), 2,
"sci_localtime_r", "sci_time.c");
exit (EXIT_FAILURE);
} else {
return (result);
}
}
This doesn't...
struct tm *sci_localtime_r (time_t timep) {
struct tm *result;
if ((localtime_r(&timep, result)) == NULL) {
int errsv = errno;
fprintf (stderr, "\nError Code %i: %s at line
%i of %s function in %s \
\n", strerror (errsv), 2,
"sci_localtime_r", "sci_time.c");
exit (EXIT_FAILURE);
} else {
return (result);
}
}
Keep in mind, I have a wrapper for time() and
asctime_r() and they work just fine. The segfault is
being caused by localtime_r(). I mean I changed it to
localtime() and everything worked. When I change it
back to localtime_r() it doesn't. Anyone ever
encounter this bug? Anyway, I plan to update my Cygwin
DLL to see if it fixes the problem.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/