aboutsummaryrefslogtreecommitdiffstats
path: root/archivers
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-05-31 18:12:21 +0800
committerache <ache@FreeBSD.org>2002-05-31 18:12:21 +0800
commit6c5681db8a7ff7fa4c4494a3cf4f03adb6de13d8 (patch)
tree0e48eba9ed4bcdfbd02269540568d9a8694b4a9f /archivers
parent95ffbd7cc1bee25f115308f2b272add084ab83c3 (diff)
downloadfreebsd-ports-gnome-6c5681db8a7ff7fa4c4494a3cf4f03adb6de13d8.tar.gz
freebsd-ports-gnome-6c5681db8a7ff7fa4c4494a3cf4f03adb6de13d8.tar.zst
freebsd-ports-gnome-6c5681db8a7ff7fa4c4494a3cf4f03adb6de13d8.zip
Prevent negative fseek for old FreeBSD versions
PR: 33170 Submitted by: "Vadim Mikhailov" <mvp@braz.ru> (partially)
Diffstat (limited to 'archivers')
-rw-r--r--archivers/zip/Makefile1
-rw-r--r--archivers/zip/files/patch-negfseek59
2 files changed, 60 insertions, 0 deletions
diff --git a/archivers/zip/Makefile b/archivers/zip/Makefile
index 0b3e547ea8d2..86f9938f2d26 100644
--- a/archivers/zip/Makefile
+++ b/archivers/zip/Makefile
@@ -8,6 +8,7 @@
PORTNAME= zip
PORTVERSION= 2.3
+PORTREVISION= 1
CATEGORIES= archivers
MASTER_SITES= ftp://ftp.uu.net/pub/archiving/zip/src/ \
${MASTER_SITE_TEX_CTAN:S,%SUBDIR%,tools/zip/info-zip/src/,}
diff --git a/archivers/zip/files/patch-negfseek b/archivers/zip/files/patch-negfseek
new file mode 100644
index 000000000000..32471538823b
--- /dev/null
+++ b/archivers/zip/files/patch-negfseek
@@ -0,0 +1,59 @@
+--- zipfile.c.orig Sun Nov 7 13:30:11 1999
++++ zipfile.c Fri May 31 13:58:36 2002
+@@ -14,6 +14,10 @@
+ #include "zip.h"
+ #include "revision.h"
+
++#ifdef __FreeBSD__
++#include <sys/param.h>
++#endif
++
+ #ifdef VMS
+ # include <rms.h>
+ # include <starlet.h>
+@@ -628,6 +632,18 @@
+
+ #endif /* !UTIL */
+
++#ifdef __FreeBSD__
++#if __FreeBSD_version < 500028
++local off_t fsize(FILE *f) {
++ struct stat s;
++
++ if (f == NULL) return 0;
++ if (fstat(fileno(f), &s) < 0) return 0;
++ return s.st_size;
++}
++#endif
++#endif
++
+ /*
+ * scanzipf_reg starts searching for the End Signature at the end of the file
+ * The End Signature points to the Central Directory Signature which points
+@@ -667,7 +683,13 @@
+ t[1] = '\0';
+ t[2] = '\0';
+ t[3] = '\0';
+- if (fseek(f, -4096L, SEEK_END) == 0) {
++ if (
++#ifdef __FreeBSD__
++#if __FreeBSD_version < 500028
++ fsize(f) >= 4096L &&
++#endif
++#endif
++ fseek(f, -4096L, SEEK_END) == 0) {
+ zipbeg = (ulg) (ftell(f) + 4096L);
+ while (!found && zipbeg >= 4096) {
+ zipbeg -= 4096L;
+@@ -678,6 +700,11 @@
+ * XXX error check ??
+ */
+ fread(buf, 1, 4096, f);
++#ifdef __FreeBSD__
++#if __FreeBSD_version < 500028
++ if (ftell(f) >= 8192L)
++#endif
++#endif
+ fseek(f, -8192L, SEEK_CUR);
+ t = &buf[4095];
+ /*