[csw-devel] SF.net SVN: gar:[12987] csw/mgar/pkg/xorriso/trunk

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Mon Jan 17 17:00:15 CET 2011


Revision: 12987
          http://gar.svn.sourceforge.net/gar/?rev=12987&view=rev
Author:   dmichelsen
Date:     2011-01-17 16:00:15 +0000 (Mon, 17 Jan 2011)

Log Message:
-----------
xorriso: Add patch for gmtime substitute

Modified Paths:
--------------
    csw/mgar/pkg/xorriso/trunk/Makefile

Added Paths:
-----------
    csw/mgar/pkg/xorriso/trunk/files/0003-Use-timegm-substitute-which-does-not-use-setenv.patch

Modified: csw/mgar/pkg/xorriso/trunk/Makefile
===================================================================
--- csw/mgar/pkg/xorriso/trunk/Makefile	2011-01-17 15:33:34 UTC (rev 12986)
+++ csw/mgar/pkg/xorriso/trunk/Makefile	2011-01-17 16:00:15 UTC (rev 12987)
@@ -12,10 +12,16 @@
 
 PATCHFILES += 0001-Use-inttypes.h-when-stdint.h-is-not-available.patch
 PATCHFILES += 0002-Add-linkage-to-librt.so-for-nanosleep-if-necessary.patch
+PATCHFILES += 0003-Use-timegm-substitute-which-does-not-use-setenv.patch
 
 # File name regex to get notifications about upstream software releases
 UFILES_REGEX = $(NAME)-(\d+(?:\.\d+)*).tar.gz
 
 CONFIGURE_ARGS = $(DIRPATHS)
 
+RUNTIME_DEP_PKGS_CSWxorriso += CSWiconv
+RUNTIME_DEP_PKGS_CSWxorriso += CSWreadline
+RUNTIME_DEP_PKGS_CSWxorriso += CSWbzip2
+RUNTIME_DEP_PKGS_CSWxorriso += CSWzlib
+
 include gar/category.mk

Added: csw/mgar/pkg/xorriso/trunk/files/0003-Use-timegm-substitute-which-does-not-use-setenv.patch
===================================================================
--- csw/mgar/pkg/xorriso/trunk/files/0003-Use-timegm-substitute-which-does-not-use-setenv.patch	                        (rev 0)
+++ csw/mgar/pkg/xorriso/trunk/files/0003-Use-timegm-substitute-which-does-not-use-setenv.patch	2011-01-17 16:00:15 UTC (rev 12987)
@@ -0,0 +1,75 @@
+From 85f8f0e5c9789b3d9dcc77035454e409ef3c2983 Mon Sep 17 00:00:00 2001
+From: Dagobert Michelsen <dam at opencsw.org>
+Date: Mon, 17 Jan 2011 16:51:58 +0100
+Subject: [PATCH] Use timegm substitute which does not use setenv
+
+---
+ libisofs/util.c |   50 ++++++++++++++++++++++++++++++++++++--------------
+ 1 files changed, 36 insertions(+), 14 deletions(-)
+
+diff --git a/libisofs/util.c b/libisofs/util.c
+index 906cb8c..5eb214d 100644
+--- a/libisofs/util.c
++++ b/libisofs/util.c
+@@ -1298,22 +1298,44 @@ void iso_datetime_17(unsigned char *buf, time_t t, int always_gmt)
+ }
+ 
+ #ifndef HAVE_TIMEGM
+-static
++
++static int is_leap(unsigned y)
++{
++	y += 1900;
++	return (y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0);
++}
++
+ time_t timegm(struct tm *tm)
+ {
+-    time_t ret;
+-    char *tz;
+-
+-    tz = getenv("TZ");
+-    setenv("TZ", "", 1);
+-    tzset();
+-    ret = mktime(tm);
+-    if (tz)
+-        setenv("TZ", tz, 1);
+-    else
+-        unsetenv("TZ");
+-    tzset();
+-    return ret;
++	static const unsigned ndays[2][12] ={
++		{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
++		{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
++	time_t res = 0;
++	unsigned i;
++
++	if (tm->tm_mon > 12 ||
++	    tm->tm_mon < 0 ||
++	    tm->tm_mday > 31 ||
++	    tm->tm_min > 60 ||
++	    tm->tm_sec > 60 ||
++	    tm->tm_hour > 24) {
++		/* invalid tm structure */
++		return 0;
++	}
++	
++	for (i = 70; i < tm->tm_year; ++i)
++		res += is_leap(i) ? 366 : 365;
++	
++	for (i = 0; i < tm->tm_mon; ++i)
++		res += ndays[is_leap(tm->tm_year)][i];
++	res += tm->tm_mday - 1;
++	res *= 24;
++	res += tm->tm_hour;
++	res *= 60;
++	res += tm->tm_min;
++	res *= 60;
++	res += tm->tm_sec;
++	return res;
+ }
+ #endif
+ 
+-- 
+1.7.3.2
+


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list