From 33afd7d529031c8afd616b2304ce6e37cd1f6155 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 15 May 2007 09:32:58 +0000 Subject: [PATCH] kes Rework bsmtp date editing for Win32. kes Add new cats entry point so Win32 builds. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4790 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/cats/mysql.c | 2 ++ bacula/src/lib/bsnprintf.c | 2 +- bacula/src/tools/bsmtp.c | 22 +++++++++------------- bacula/technotes-2.1 | 5 ++++- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/bacula/src/cats/mysql.c b/bacula/src/cats/mysql.c index a8211c7934..6c4d6b09e4 100644 --- a/bacula/src/cats/mysql.c +++ b/bacula/src/cats/mysql.c @@ -268,7 +268,9 @@ db_close_database(JCR *jcr, B_DB *mdb) */ void db_thread_cleanup() { +#ifndef HAVE_WIN32 my_thread_end(); +#endif } /* diff --git a/bacula/src/lib/bsnprintf.c b/bacula/src/lib/bsnprintf.c index 1785759a0e..55262f3f42 100644 --- a/bacula/src/lib/bsnprintf.c +++ b/bacula/src/lib/bsnprintf.c @@ -332,7 +332,7 @@ int bvsnprintf(char *buffer, int32_t maxlen, const char *format, va_list args) } else if (sizeof(char *) == 8) { value = va_arg(args, uint64_t); } else { - value = (uint64_t)va_arg(args, char *); + value = 0; /* we have a problem */ } currlen = fmtint(buffer, currlen, maxlen, value, 16, min, max, flags); break; diff --git a/bacula/src/tools/bsmtp.c b/bacula/src/tools/bsmtp.c index 2701f7ba4e..597cb34979 100644 --- a/bacula/src/tools/bsmtp.c +++ b/bacula/src/tools/bsmtp.c @@ -150,6 +150,7 @@ static void get_date_string(char *buf, int buf_len) time_t now = time(NULL); struct tm tm; char tzbuf[MAXSTRING]; + long my_timezone; /* Add RFC822 date */ (void)localtime_r(&now, &tm); @@ -158,28 +159,23 @@ static void get_date_string(char *buf, int buf_len) #if defined(HAVE_MINGW) __MINGW_IMPORT long _dstbias; #endif - long tzoffset = 0; - _tzset(); + my_timezone = _timezone; + my_timezone += _dstbias; + my_timezone /= 60; - tzoffset = _timezone; - tzoffset += _dstbias; - tzoffset /= 60; - - size_t length = strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S", &tm); - sprintf(&buf[length], " %+2.2ld%2.2u", -tzoffset / 60, abs(tzoffset) % 60); #else - strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S", &tm); tzset(); - timezone /= 60; /* timezone offset in mins */ + my_timezone = timezone / 60; /* timezone offset in mins */ if (tm.tm_isdst == 1) { - timezone -= 60; /* adjust for daylight savings */ + my_timezone -= 60; /* adjust for daylight savings */ } - sprintf(tzbuf, " %+2.2ld%2.2u", -timezone / 60, abs(timezone) % 60); +#endif + strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S", &tm); + sprintf(tzbuf, " %+2.2ld%2.2u", -my_timezone / 60, abs(my_timezone) % 60); strcat(buf, tzbuf); /* add +0100 */ strftime(tzbuf, sizeof(tzbuf), " (%Z)", &tm); strcat(buf, tzbuf); /* add (CEST) */ -#endif } diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 6c8c042a00..bff28e5625 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,8 +1,11 @@ Technical notes on version 2.1 General: +15May07 +kes Rework bsmtp date editing for Win32. +kes Add new cats entry point so Win32 builds. 14May07 -kes Attempt to fix bsmtp editing on OSes without %z editing. +kes Attempt to fix bsmtp date editing on OSes without %z editing. Fixes bug #854. kes Do better checking for the MySQL 64 bit libraries looking for both .a and .so libraries. -- 2.39.5