< prev index next >

src/java.base/share/native/libjli/parse_manifest.c

Print this page
rev 53302 : 8217093: Support extended-length paths in parse_manifest.c on windows

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -360,13 +360,15 @@
     }
 
     bp = buffer;
 
     if (find_positions(fd, bp, &base_offset, &censtart) == -1) {
+        free(buffer);
         return -1;
     }
     if (JLI_Lseek(fd, censtart, SEEK_SET) < (jlong) 0) {
+        free(buffer);
         return -1;
     }
 
     if ((bytes = read(fd, bp, MINREAD)) < 0) {
         free(buffer);

@@ -560,10 +562,16 @@
     *value = cp;
     *lp = nl;
     return (1);
 }
 
+#ifdef _WIN32
+int open_jarfile(const char* name, int flags);
+#else
+int open_jarfile(const char* name, int flags) { return open(name, flags); }
+#endif
+
 /*
  * Read the manifest from the specified jar file and fill in the manifest_info
  * structure with the information found within.
  *
  * Error returns are as follows:

@@ -581,11 +589,11 @@
     char    *name;
     char    *value;
     int     rc;
     char    *splashscreen_name = NULL;
 
-    if ((fd = open(jarfile, O_RDONLY
+    if ((fd = open_jarfile(jarfile, O_RDONLY
 #ifdef O_LARGEFILE
         | O_LARGEFILE /* large file mode */
 #endif
 #ifdef O_BINARY
         | O_BINARY /* use binary mode on windows */

@@ -638,11 +646,11 @@
 JLI_JarUnpackFile(const char *jarfile, const char *filename, int *size) {
     int     fd;
     zentry  entry;
     void    *data = NULL;
 
-    if ((fd = open(jarfile, O_RDONLY
+    if ((fd = open_jarfile(jarfile, O_RDONLY
 #ifdef O_LARGEFILE
         | O_LARGEFILE /* large file mode */
 #endif
 #ifdef O_BINARY
         | O_BINARY /* use binary mode on windows */

@@ -686,11 +694,11 @@
     char    *lp;        /* pointer into manifest, updated during iteration */
     char    *name;
     char    *value;
     int     rc;
 
-    if ((fd = open(jarfile, O_RDONLY
+    if ((fd = open_jarfile(jarfile, O_RDONLY
 #ifdef O_LARGEFILE
         | O_LARGEFILE /* large file mode */
 #endif
 #ifdef O_BINARY
         | O_BINARY /* use binary mode on windows */
< prev index next >