Dmitry Timoshkov : msvcrt: Restore error handling code in localtime.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Aug 21 15:22:19 CDT 2007
Module: wine
Branch: master
Commit: e98d1da7d4ad94e7d07a33a4d8bfb5ec7ec7408f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e98d1da7d4ad94e7d07a33a4d8bfb5ec7ec7408f
Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date: Tue Aug 21 21:44:24 2007 +0900
msvcrt: Restore error handling code in localtime.
---
dlls/msvcrt/time.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index 4d75fb9..69762e0 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -105,10 +105,14 @@ MSVCRT_time_t CDECL MSVCRT_mktime(struct MSVCRT_tm *mstm)
struct MSVCRT_tm* CDECL MSVCRT_localtime(const MSVCRT_time_t* secs)
{
struct tm tm;
- thread_data_t *data = msvcrt_get_thread_data();
+ thread_data_t *data;
time_t seconds = *secs;
- localtime_r( &seconds, &tm );
+ if (seconds < 0) return NULL;
+
+ if (!localtime_r( &seconds, &tm )) return NULL;
+
+ data = msvcrt_get_thread_data();
unix_tm_to_msvcrt( &data->time_buffer, &tm );
return &data->time_buffer;
More information about the wine-cvs
mailing list