This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Weird New libjava Testsuite Failure (PR java/14104)


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;
  }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]