This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Weird New libjava Testsuite Failure (PR java/14104)
- From: Andrew Haley <aph at redhat dot com>
- To: Ranjit Mathew <rmathew at hotmail dot com>, java at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 17 Mar 2004 14:03:52 +0000
- Subject: Weird New libjava Testsuite Failure (PR java/14104)
- References: <c39dcc$ind$1@sea.gmane.org><16472.15031.279252.152726@cuddles.cambridge.redhat.com><16472.15512.720545.624610@cuddles.cambridge.redhat.com><16472.19509.313835.851697@cuddles.cambridge.redhat.com>
The test failure "linking simple" is because the error handling in
opendir_in_zip() is quite insane. This patch tidies up that error
handling.
Andrew.
2004-03-17 Andrew Haley <aph@redhat.com>
PR java/14104
* jcf-io.c (opendir_in_zip): Tidy up error handling for all
control flow paths.
Index: jcf-io.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-io.c,v
retrieving revision 1.48
diff -p -2 -c -r1.48 jcf-io.c
*** jcf-io.c 20 Dec 2003 15:38:27 -0000 1.48
--- jcf-io.c 17 Mar 2004 13:58:19 -0000
*************** opendir_in_zip (const char *zipfile, int
*** 121,125 ****
zipf->name = (char*)(zipf+1);
strcpy (zipf->name, zipfile);
- SeenZipFiles = zipf;
fd = open (zipfile, O_RDONLY | O_BINARY);
zipf->fd = fd;
--- 121,124 ----
*************** opendir_in_zip (const char *zipfile, int
*** 128,134 ****
/* A missing zip file is not considered an error.
We may want to re-consider that. FIXME. */
! zipf->count = 0;
! zipf->dir_size = 0;
! zipf->central_directory = NULL;
}
else
--- 127,131 ----
/* A missing zip file is not considered an error.
We may want to re-consider that. FIXME. */
! goto fail;
}
else
*************** opendir_in_zip (const char *zipfile, int
*** 136,145 ****
jcf_dependency_add_file (zipfile, is_system);
if (read (fd, magic, 4) != 4 || GET_u4 (magic) != (JCF_u4)ZIPMAGIC)
! return NULL;
lseek (fd, 0L, SEEK_SET);
if (read_zip_archive (zipf) != 0)
! return NULL;
}
return zipf;
}
--- 133,150 ----
jcf_dependency_add_file (zipfile, is_system);
if (read (fd, magic, 4) != 4 || GET_u4 (magic) != (JCF_u4)ZIPMAGIC)
! goto fail;
lseek (fd, 0L, SEEK_SET);
if (read_zip_archive (zipf) != 0)
! goto fail;
}
+
+ SeenZipFiles = zipf;
return zipf;
+
+ fail:
+ zipf->count = 0;
+ zipf->dir_size = 0;
+ zipf->central_directory = NULL;
+ return NULL;
}