Bugs item #1468330, was opened at 2006-04-11 12:13
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1468330&group_id=976
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: compile or build problem
Group: crash
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: time_t type-cast problem with VS2005
Initial Comment:
main.c #line 2987
tv = curlx_tvnow();
now = localtime((time_t *)&tv.tv_sec);
Crash in localtime() (Debug-Version), because the
type-cast to time_t-pointer above!
Type of tv.tv_sec : unsigned integer (32-BIT).
Type of time_t is (now) the same as __time64_t !
Maybe compile-time definitione "_USE_32BIT_TIME_T"
should be used ...
----------------------------------------------------------------------
Comment By: Daniel Stenberg (bagder)
Date: 2006-04-11 12:46
Message:
Logged In: YES
user_id=1110
Thanks!
I suggest and will apply the fix below:
diff -u -r1.356 main.c
--- main.c 9 Apr 2006 22:41:23 -0000 1.356
+++ main.c 11 Apr 2006 10:45:43 -0000
@@ -3078,11 +3078,13 @@
struct timeval tv;
struct tm *now;
char timebuf[20];
+ time_t secs;
(void)handle; /* prevent compiler warning */
tv = curlx_tvnow();
- now = localtime((time_t *)&tv.tv_sec); /* not
multithread safe but we don't care */
+ secs = tv.tv_sec;
+ now = localtime(&secs); /* not multithread safe but we
don't care */
if(config->tracetime)
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06d ",
now->tm_hour, now->tm_min, now->tm_sec,
tv.tv_usec);
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1468330&group_id=976
Received on 2006-04-13