26 lines
1.1 KiB
Diff
26 lines
1.1 KiB
Diff
diff -Nru gcc-4.0.2.orig/gcc/java/zextract.c gcc-4.0.2/gcc/java/zextract.c
|
|
--- gcc-4.0.2.orig/gcc/java/zextract.c 2005-10-21 12:02:51.000000000 +0200
|
|
+++ gcc-4.0.2/gcc/java/zextract.c 2005-10-24 12:10:13.000000000 +0200
|
|
@@ -287,6 +287,21 @@
|
|
return -1;
|
|
if (read (zipf->fd, buffer, ECREC_SIZE+4) != ECREC_SIZE+4)
|
|
return -2;
|
|
+ if (buffer[0] != 'P' || strncmp ((const char *) &buffer[1], END_CENTRAL_SIG, 3)) {
|
|
+ /* We could not find the end-central-header signature, probably
|
|
+ because a zipfile comment is present. Scan backwards until we
|
|
+ find the signature. */
|
|
+ if (lseek (zipf->fd, (long)(-ECREC_SIZE), SEEK_END) <= 0)
|
|
+ return -2;
|
|
+ while (buffer[0] != 'P' || strncmp ((const char *) &buffer[1], END_CENTRAL_SIG, 3)) {
|
|
+ if (lseek (zipf->fd, -5, SEEK_CUR) < 0)
|
|
+ return -2;
|
|
+ if (read (zipf->fd, buffer, 4) != 4)
|
|
+ return -2;
|
|
+ }
|
|
+ if (read (zipf->fd, buffer + 4, ECREC_SIZE) != ECREC_SIZE)
|
|
+ return -2;
|
|
+ }
|
|
zipf->count = makeword((const uch *) &buffer[TOTAL_ENTRIES_CENTRAL_DIR]);
|
|
zipf->dir_size = makelong((const uch *) &buffer[SIZE_CENTRAL_DIRECTORY]);
|
|
#define ALLOC xmalloc
|