From 03643c862107e504e4477020119e0f3d000da41a Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Mon, 12 Mar 2012 05:53:07 -0400 Subject: [PATCH] Set timezone compatible with previous version. Patch from N. Boullis. --- lib/iso9660/iso9660.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/iso9660/iso9660.c b/lib/iso9660/iso9660.c index fd589d6d..c55ed5cf 100644 --- a/lib/iso9660/iso9660.c +++ b/lib/iso9660/iso9660.c @@ -335,15 +335,17 @@ iso9660_set_dtime_with_timezone (const struct tm *p_tm, Set time in format used in ISO 9660 directory index record from a Unix time structure. */ void -iso9660_set_dtime (const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date) +iso9660_set_dtime(const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date) { - int time_zone; + int time_zone = 0; + if (p_tm) { #ifdef HAVE_TM_GMTOFF - /* Convert seconds to minutes */ - time_zone = p_tm->tm_gmtoff / 60; + /* Convert seconds to minutes */ + time_zone = p_tm->tm_gmtoff / 60; #else - time_zone = (p_tm->tm_isdst > 0) ? -60 : 0; + time_zone = (p_tm->tm_isdst > 0) ? -60 : 0; #endif + } iso9660_set_dtime_with_timezone (p_tm, time_zone, p_idr_date); } @@ -353,9 +355,9 @@ iso9660_set_dtime (const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date) correction in minutes. */ void -iso9660_set_ltime_with_timezone (const struct tm *p_tm, - int time_zone, - /*out*/ iso9660_ltime_t *pvd_date) +iso9660_set_ltime_with_timezone(const struct tm *p_tm, + int time_zone, + /*out*/ iso9660_ltime_t *pvd_date) { char *_pvd_date = (char *) pvd_date; @@ -388,15 +390,17 @@ iso9660_set_ltime_with_timezone (const struct tm *p_tm, Set "long" time in format used in ISO 9660 primary volume descriptor from a Unix time structure. */ void -iso9660_set_ltime (const struct tm *p_tm, /*out*/ iso9660_ltime_t *pvd_date) +iso9660_set_ltime(const struct tm *p_tm, /*out*/ iso9660_ltime_t *pvd_date) { - int time_zone; + int time_zone = 0; + if (p_tm) { #ifdef HAVE_TM_GMTOFF - /* Set time zone in 15-minute interval encoding. */ - time_zone = p_tm->tm_gmtoff / 60; + /* Set time zone in 15-minute interval encoding. */ + time_zone = p_tm->tm_gmtoff / 60; #else - time_zone = (p_tm->tm_isdst > 0) ? -60 : 0; + time_zone = (p_tm->tm_isdst > 0) ? -60 : 0; #endif + } iso9660_set_ltime_with_timezone (p_tm, time_zone, pvd_date); } @@ -666,8 +670,8 @@ iso9660_set_pvd(void *pd, iso9660_set_ltime (&temp_tm, &(ipd.creation_date)); gmtime_r(pvd_time, &temp_tm); iso9660_set_ltime (&temp_tm, &(ipd.modification_date)); - iso9660_set_ltime (&temp_tm, &(ipd.expiration_date)); - iso9660_set_ltime (&temp_tm, &(ipd.effective_date)); + iso9660_set_ltime (NULL, &(ipd.expiration_date)); + iso9660_set_ltime (NULL, &(ipd.effective_date)); ipd.file_structure_version = to_711(1);