This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: (fastjar) Open Extracted Files in Binary Mode
- From: Ranjit Mathew <rmathew at hotmail dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Thu, 21 Nov 2002 11:15:17 +0530
- Subject: Patch: (fastjar) Open Extracted Files in Binary Mode
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/