summaryrefslogtreecommitdiff
path: root/source3/utils/net_cache.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-11-27 19:52:11 +0100
committerVolker Lendecke <vlendec@samba.org>2010-11-27 20:50:27 +0100
commit2f40657ab3259f70c27d88786cdd0453fc845859 (patch)
treecbbd398931fd0c99e2b6f27f35ad6e27ff2ab596 /source3/utils/net_cache.c
parent87c67433c8119986cab3d6948c37b85c7962c62e (diff)
downloadsamba-2f40657ab3259f70c27d88786cdd0453fc845859.tar.gz
samba-2f40657ab3259f70c27d88786cdd0453fc845859.tar.bz2
samba-2f40657ab3259f70c27d88786cdd0453fc845859.zip
s3: Use localtime_r, libreplace defines it
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sat Nov 27 20:50:27 CET 2010 on sn-devel-104
Diffstat (limited to 'source3/utils/net_cache.c')
-rw-r--r--source3/utils/net_cache.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/source3/utils/net_cache.c b/source3/utils/net_cache.c
index fef269d77d..4339094489 100644
--- a/source3/utils/net_cache.c
+++ b/source3/utils/net_cache.c
@@ -39,24 +39,22 @@ static void print_cache_entry(const char* keystr, const char* datastr,
char *timeout_str;
char *alloc_str = NULL;
time_t now_t = time(NULL);
- struct tm timeout_tm, *now_tm;
- /* localtime returns statically allocated pointer, so timeout_tm
- has to be copied somewhere else */
+ struct tm timeout_tm, now_tm;
+ struct tm *ptimeout_tm, *pnow_tm;
- now_tm = localtime(&timeout);
- if (!now_tm) {
+ ptimeout_tm = localtime_r(&timeout, &timeout_tm);
+ if (ptimeout_tm == NULL) {
return;
}
- memcpy(&timeout_tm, now_tm, sizeof(struct tm));
- now_tm = localtime(&now_t);
- if (!now_tm) {
+ pnow_tm = localtime_r(&now_t, &now_tm);
+ if (pnow_tm == NULL) {
return;
}
/* form up timeout string depending whether it's today's date or not */
- if (timeout_tm.tm_year != now_tm->tm_year ||
- timeout_tm.tm_mon != now_tm->tm_mon ||
- timeout_tm.tm_mday != now_tm->tm_mday) {
+ if (timeout_tm.tm_year != now_tm.tm_year ||
+ timeout_tm.tm_mon != now_tm.tm_mon ||
+ timeout_tm.tm_mday != now_tm.tm_mday) {
timeout_str = asctime(&timeout_tm);
if (!timeout_str) {