summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>2010-06-14 11:24:47 +0000
committertron <tron@pkgsrc.org>2010-06-14 11:24:47 +0000
commit8e42807f3222bd47eeaa7bd5eed8383426cb2ee5 (patch)
tree731441e0c718d0ead61df51aa04b5ffda9d981d4 /pkgtools
parent4e6f35650d5106ff29ba30c0420144b48b9254d4 (diff)
downloadpkgsrc-8e42807f3222bd47eeaa7bd5eed8383426cb2ee5.tar.gz
Update "rpm2pkg" to version 3.0.1. Changes since 3.0:
- Fix detection of BZip2/GZip signature which would have failed if the signature was located behind a prefix of the signature. - Increase I/O buffer size so that "rpm2pkg" will usually find the data section after only one read(2) system call.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/rpm2pkg/Makefile4
-rw-r--r--pkgtools/rpm2pkg/files/rpm2pkg.c18
2 files changed, 12 insertions, 10 deletions
diff --git a/pkgtools/rpm2pkg/Makefile b/pkgtools/rpm2pkg/Makefile
index f7c2552d59f..fb51839bc37 100644
--- a/pkgtools/rpm2pkg/Makefile
+++ b/pkgtools/rpm2pkg/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.44 2010/06/13 13:08:51 tron Exp $
+# $NetBSD: Makefile,v 1.45 2010/06/14 11:24:47 tron Exp $
-DISTNAME= rpm2pkg-3.0
+DISTNAME= rpm2pkg-3.0.1
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/rpm2pkg/files/rpm2pkg.c b/pkgtools/rpm2pkg/files/rpm2pkg.c
index 7ad65e2ea24..51d71057626 100644
--- a/pkgtools/rpm2pkg/files/rpm2pkg.c
+++ b/pkgtools/rpm2pkg/files/rpm2pkg.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rpm2pkg.c,v 1.9 2010/06/13 13:08:52 tron Exp $ */
+/* $NetBSD: rpm2pkg.c,v 1.10 2010/06/14 11:24:48 tron Exp $ */
/*-
* Copyright (c) 2004-2009 The NetBSD Foundation, Inc.
@@ -179,7 +179,7 @@ IsRPMFile(int fd)
static FileHandle *
Open(int fd)
{
- unsigned char buffer[4096];
+ unsigned char buffer[16384];
size_t bzMatch, gzMatch;
int archive_type;
off_t offset;
@@ -197,8 +197,12 @@ Open(int fd)
return NULL;
for (i = 0; i < bytes; i++) {
+ unsigned char cur_char;
+
+ cur_char = buffer[i];
+
/* Look for bzip2 header. */
- if (buffer[i] == BZipMagic[bzMatch]) {
+ if (cur_char == BZipMagic[bzMatch]) {
bzMatch++;
if (bzMatch == sizeof(BZipMagic)) {
archive_type = 1;
@@ -207,11 +211,11 @@ Open(int fd)
break;
}
} else {
- bzMatch = 0;
+ bzMatch = (cur_char == BZipMagic[0]) ? 1 : 0;
}
/* Look for gzip header. */
- if (buffer[i] == GZipMagic[gzMatch]) {
+ if (cur_char == GZipMagic[gzMatch]) {
gzMatch++;
if (gzMatch == sizeof(GZipMagic)) {
archive_type = 2;
@@ -220,10 +224,8 @@ Open(int fd)
break;
}
} else {
- gzMatch = 0;
+ gzMatch = (cur_char == GZipMagic[0]) ? 1 : 0;
}
-
- offset++;
}
} while (archive_type == 0);