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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to