PATCH: unzip seek fix
Stefani Seibold
stefani at seibold.net
Fri Jul 24 20:18:01 UTC 2009
Attached is a small fix for the unzip applet.
The current version of the unzip applet use bb_copyfd_exact_size() to
skip a zipped file and goto the next. This is very slow, especially on
huge files or slow devices like usb 1.1 interfaces.
This one liner fix use first lseek() to skip the file and if this fails
in case of a pipe it use bb_copyfd_exact_size().
This improve dramatically the speed of "unzip -l zipfile.zip" or "unzip
zipfile.zip file".
I hope you like it.
Stefani
diff -u -N -r busybox-1.13.4/archival/unzip.c busybox-1.13.4.new/archival/unzip.c
--- busybox-1.14.2/archival/unzip.c 2009-05-18 12:07:00.000000000 +0200
+++ busybox-1.14.2.new/archival/unzip.c 2009-05-18 12:07:07.000000000 +0200
@@ -208,6 +208,7 @@
static void unzip_skip(off_t skip)
{
+ if (lseek(zip_fd, skip, SEEK_CUR) == (off_t)-1)
bb_copyfd_exact_size(zip_fd, -1, skip);
}
static void unzip_create_leading_dirs(const char *fn)
More information about the busybox
mailing list