Patch: (fastjar) Open Extracted Files in Binary Mode

Ranjit Mathew rmathew@hotmail.com
Wed Nov 20 21:44:00 GMT 2002


Hi,

     The jar tool uses the "creat( )" function to
create extracted files - it should use "open( )"
instead with O_BINARY - otherwise, binary files
on Windows get corrupted. The following patch
proposes to fix this.

ChangeLog:

2002-11-21  Ranjit Mathew <rmathew@hotmail.com>

     * fastjar/jartool.c (extract_jar): Use "open" with
     O_BINARY instead of "creat" to create extracted files.

Patch:
------------------------ 8< --------------------------------
--- jartool.c   Thu Nov 21 11:04:35 2002
+++ jartool.c   Thu Nov 21 11:09:50 2002
@@ -1456,5 +1456,6 @@

      if(f_fd != -1 && handle){
-      f_fd = creat((const char *)filename, 00644);
+      f_fd = open((const char *)filename,
+                  O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 00644);

        if(f_fd < 0){
------------------------ 8< --------------------------------

Sincerely Yours,
Ranjit.

-- 
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/





More information about the Java-patches mailing list