diff options
author | William Pitcock <nenolod@dereferenced.org> | 2011-04-28 02:59:17 -0500 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2011-04-28 02:59:17 -0500 |
commit | 5cabd60586706bd860e24a6e875d3f177ba3524d (patch) | |
tree | 4ef85c34fe7993aaae524e6130d0094d457afa7c /main/tzdata/0001-posixtz-fix-up-lseek.patch | |
parent | de1f1f48d87f26457a5d0c37cc9a2de819bb4a35 (diff) | |
download | aports-5cabd60586706bd860e24a6e875d3f177ba3524d.tar.bz2 aports-5cabd60586706bd860e24a6e875d3f177ba3524d.tar.xz |
main/tzdata: stdio hack not needed, was a wordmasking issue
Diffstat (limited to 'main/tzdata/0001-posixtz-fix-up-lseek.patch')
-rw-r--r-- | main/tzdata/0001-posixtz-fix-up-lseek.patch | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/main/tzdata/0001-posixtz-fix-up-lseek.patch b/main/tzdata/0001-posixtz-fix-up-lseek.patch index c5b0c74a08..1db3eba9eb 100644 --- a/main/tzdata/0001-posixtz-fix-up-lseek.patch +++ b/main/tzdata/0001-posixtz-fix-up-lseek.patch @@ -1,47 +1,27 @@ +From 5c4cd3cee03428636e8d7cc4ed644389a4d598b3 Mon Sep 17 00:00:00 2001 +From: William Pitcock <nenolod@dereferenced.org> +Date: Thu, 28 Apr 2011 02:56:42 -0500 +Subject: [PATCH] posixtz: ensure the file offset we pass to lseek is off_t + +on 32-bit systems, sizeof(off_t) is 4, on 64-bit sizeof(off_t) is 8 +causing a word masking issue. +--- + posixtz.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + diff --git a/posixtz.c b/posixtz.c -index 141cca1..604a53d 100644 +index cddcb3e..972ca31 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); +@@ -36,7 +36,7 @@ char *posix_tz(const char *filename) 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 ++ || lseek(fd, (off_t) -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; - } - +-- +1.7.4.5 + |