Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/usr.bin/gzip Pull up revision 1.47 (requested by mrg in...
details: https://anonhg.NetBSD.org/src/rev/70bbfd5d72dc
branches: netbsd-2-0
changeset: 561461:70bbfd5d72dc
user: tron <tron%NetBSD.org@localhost>
date: Fri Jun 18 09:53:50 2004 +0000
description:
Pull up revision 1.47 (requested by mrg in ticket #508):
explicitly lseek() to offset 10 to read the original name. fixes a
latent bug awoken by rev 1.37 (prior versions always left the fd at
this offset purely by chance.) fixes PR#25824.
diffstat:
usr.bin/gzip/gzip.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (46 lines):
diff -r 7ba78d5f757e -r 70bbfd5d72dc usr.bin/gzip/gzip.c
--- a/usr.bin/gzip/gzip.c Fri Jun 18 09:48:42 2004 +0000
+++ b/usr.bin/gzip/gzip.c Fri Jun 18 09:53:50 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gzip.c,v 1.29.2.13 2004/05/30 14:56:40 tron Exp $ */
+/* $NetBSD: gzip.c,v 1.29.2.14 2004/06/18 09:53:50 tron Exp $ */
/*
* Copyright (c) 1997, 1998, 2003, 2004 Matthew R. Green
@@ -32,7 +32,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004 Matthew R. Green\n\
All rights reserved.\n");
-__RCSID("$NetBSD: gzip.c,v 1.29.2.13 2004/05/30 14:56:40 tron Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.29.2.14 2004/06/18 09:53:50 tron Exp $");
#endif /* not lint */
/*
@@ -95,6 +95,8 @@
#define GZIP_MAGIC1 0x8B
#define GZIP_OMAGIC1 0x9E
+#define GZIP_ORIGNAME (off_t)10
+
#define HEAD_CRC 0x02
#define EXTRA_FIELD 0x04
#define ORIG_NAME 0x08
@@ -1065,6 +1067,10 @@
size_t rbytes;
int i;
+ if (lseek(fd, GZIP_ORIGNAME, SEEK_SET) == -1) {
+ maybe_warn("can't lseek %s", file);
+ goto close_header_read;
+ }
rbytes = read(fd, name, PATH_MAX + 1);
if (rbytes < 0) {
maybe_warn("can't read %s", file);
@@ -1089,6 +1095,7 @@
}
}
}
+close_header_read:
close(fd);
if (cflag == 0 || lflag) {
Home |
Main Index |
Thread Index |
Old Index