aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2011-04-28 02:52:56 -0500
committerWilliam Pitcock <nenolod@dereferenced.org>2011-04-28 02:52:56 -0500
commitde1f1f48d87f26457a5d0c37cc9a2de819bb4a35 (patch)
tree354f84e1d12ef2c464ded7be1eabf74cb6ffac59
parent1ed5b7f51bcce2c0431dc48d2ccaeb3a7f5b663c (diff)
downloadaports-de1f1f48d87f26457a5d0c37cc9a2de819bb4a35.tar.bz2
aports-de1f1f48d87f26457a5d0c37cc9a2de819bb4a35.tar.xz
main/tzdata: use stdio instead of raw fd operations to work around lseek bug
fix #602
-rw-r--r--main/tzdata/0001-posixtz-fix-up-lseek.patch47
-rw-r--r--main/tzdata/APKBUILD12
2 files changed, 54 insertions, 5 deletions
diff --git a/main/tzdata/0001-posixtz-fix-up-lseek.patch b/main/tzdata/0001-posixtz-fix-up-lseek.patch
new file mode 100644
index 0000000000..c5b0c74a08
--- /dev/null
+++ b/main/tzdata/0001-posixtz-fix-up-lseek.patch
@@ -0,0 +1,47 @@
+diff --git a/posixtz.c b/posixtz.c
+index 141cca1..604a53d 100644
+--- a/posixtz-0.3/posixtz.c
++++ b/posixtz-0.3/posixtz.c
+@@ -25,18 +25,19 @@
+
+ char *posix_tz(const char *filename)
+ {
+- int fd, r;
++ FILE *f;
++ size_t r;
+ static char buf[TZ_BUFLEN];
+ char *p = NULL;
+- fd = open(filename, O_RDONLY);
+- if (fd < 0)
++ f = fopen(filename, "r");
++ if (f == NULL)
+ return NULL;
+
+- r = read(fd, buf, TZ_BUFLEN);
++ r = fread(buf, 1, TZ_BUFLEN, f);
+ if (r != TZ_BUFLEN
+ || strncmp(buf, "TZif", 4) != 0
+ || (unsigned char)buf[4] < 2
+- || lseek(fd, -TZ_BUFLEN, SEEK_END) < 0
++ || fseek(f, -TZ_BUFLEN, SEEK_END) < 0
+ )
+ goto ERROR;
+
+@@ -50,7 +51,7 @@ char *posix_tz(const char *filename)
+ ** (with nothing between the newlines if there is no POSIX representation for
+ ** such instants).
+ */
+- r = read(fd, buf, TZ_BUFLEN);
++ r = fread(buf, 1, TZ_BUFLEN, f);
+ if (r <= 0 || buf[--r] != '\n')
+ goto ERROR;
+ buf[r] = 0;
+@@ -61,7 +62,7 @@ char *posix_tz(const char *filename)
+ }
+ } /* else ('\n' not found): p remains NULL */
+ ERROR:
+- close(fd);
++ fclose(f);
+ return p;
+ }
+
diff --git a/main/tzdata/APKBUILD b/main/tzdata/APKBUILD
index d08575e6b7..975de9791b 100644
--- a/main/tzdata/APKBUILD
+++ b/main/tzdata/APKBUILD
@@ -2,8 +2,8 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=tzdata
pkgver=2011e
-_ptzver=0.1
-pkgrel=0
+_ptzver=0.3
+pkgrel=1
pkgdesc="Timezone data"
url="http://www.twinsun.com/tz/tz-link.htm"
arch="all"
@@ -15,7 +15,8 @@ subpackages="$pkgname-doc"
source="ftp://elsie.nci.nih.gov/pub/tzcode$pkgver.tar.gz
ftp://elsie.nci.nih.gov/pub/tzdata$pkgver.tar.gz
http://git.alpinelinux.org/cgit/ncopa/posixtz.git/snapshot/posixtz-$_ptzver.tar.bz2
- Makefile.patch"
+ Makefile.patch
+ 0001-posixtz-fix-up-lseek.patch"
_builddir="$srcdir"
prepare() {
@@ -47,5 +48,6 @@ package() {
md5sums="fbfc05dbf9ebcfe7c4bba18549870173 tzcode2011e.tar.gz
044a07072300a0ee72b046e5a9a4ec90 tzdata2011e.tar.gz
-be1ca94f79abfa367b4c54a51737ba91 posixtz-0.1.tar.bz2
-a64ed97d1fc03c66ee8612c0d9f40507 Makefile.patch"
+99efce32b3f870e1b071ce47f3a98a18 posixtz-0.3.tar.bz2
+a64ed97d1fc03c66ee8612c0d9f40507 Makefile.patch
+e71835b0acf2dd019e4a2e5ad4b6b07a 0001-posixtz-fix-up-lseek.patch"