Patchwork libgo patch committed: Look for zoneinfo files in Solaris directory

login
register
mail settings
Submitter Ian Taylor
Date Jan. 29, 2011, 12:07 a.m.
Message ID <mcripx8shb5.fsf@google.com>
Download mbox | patch
Permalink /patch/80908/
State New
Headers show

Comments

Ian Taylor - Jan. 29, 2011, 12:07 a.m.
This patch changes libgo to look for zoneinfo files in the Solaris
directory /usr/share/lib/zoneinfo if they are not found in the
GNU/Linux, FreeBSD, Darwin directory /usr/share/zoneinfo.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian

Patch

diff -r 306be38bde46 libgo/go/time/zoneinfo_unix.go
--- a/libgo/go/time/zoneinfo_unix.go	Fri Jan 28 15:53:52 2011 -0800
+++ b/libgo/go/time/zoneinfo_unix.go	Fri Jan 28 15:56:36 2011 -0800
@@ -18,6 +18,7 @@ 
 const (
 	headerSize = 4 + 16 + 4*7
 	zoneDir    = "/usr/share/zoneinfo/"
+	zoneDir2   = "/usr/share/lib/zoneinfo/"
 )
 
 // Simple I/O interface to binary blob of data.
@@ -216,7 +217,11 @@ 
 	case err == os.ENOENV:
 		zones, _ = readinfofile("/etc/localtime")
 	case len(tz) > 0:
-		zones, _ = readinfofile(zoneDir + tz)
+		var ok bool
+		zones, ok = readinfofile(zoneDir + tz)
+		if !ok {
+			zones, _ = readinfofile(zoneDir2 + tz)
+		}
 	case len(tz) == 0:
 		// do nothing: use UTC
 	}