You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2003/11/12 18:30:33 UTC
DO NOT REPLY [Bug 24654] New: -
openFile function opens files for reading and writing instead of reading only.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24654>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24654
openFile function opens files for reading and writing instead of reading only.
Summary: openFile function opens files for reading and writing
instead of reading only.
Product: Xerces-C++
Version: 2.3.0
Platform: All
OS/Version: FreeBSD
Status: NEW
Severity: Major
Priority: Other
Component: Utilities
AssignedTo: xerces-c-dev@xml.apache.org
ReportedBy: bork@lenta.ru
In FreeBSD the function openFile opens files for reading and writing while it
shoud open them for reading only(and it does so in Linux, Solaris, Win and
others). The reason is in that it calls fopen with mode "r+", but if we look
at fopen(3) we'll see:
...
``r+'' Open for reading and writing. The stream is positioned at the
beginning of the file.
...
I've changed mode to "r" and then it worked as it should.
Here is the patch for "xerces-c-src_2_3_0/src/xercesc/util/Platforms/
FreeBSD/FreeBSDPlatformUtils.cpp":
--- FreeBSDPlatformUtils.cpp Wed Nov 12 20:31:18 2003
+++ FreeBSDPlatformUtils.cpp.new Wed Nov 12 20:31:16 2003
@@ -298,7 +298,7 @@
XMLExcepts::CPtr_PointerIsZero);
const char* tmpFileName = XMLString::transcode(fileName, fgMemoryManager);
ArrayJanitor<char> janText((char*)tmpFileName, fgMemoryManager);
- FileHandle retVal = (FileHandle)fopen( tmpFileName , "r+" );
+ FileHandle retVal = (FileHandle)fopen( tmpFileName , "r" );
return retVal;
}
@@ -307,7 +307,7 @@
if (fileName == NULL)
ThrowXML(XMLPlatformUtilsException,
XMLExcepts::CPtr_PointerIsZero);
- FileHandle retVal = (FileHandle)fopen( fileName , "r+" );
+ FileHandle retVal = (FileHandle)fopen( fileName , "r" );
return retVal;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org