You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2006/12/27 15:59:24 UTC
svn commit: r490507 -
/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
Author: amassari
Date: Wed Dec 27 06:59:23 2006
New Revision: 490507
URL: http://svn.apache.org/viewvc?view=rev&rev=490507
Log:
Detect open() failures (jira#1658)
Modified:
xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
Modified: xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp?view=diff&rev=490507&r1=490506&r2=490507
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/util/Platforms/Solaris/SolarisPlatformUtils.cpp Wed Dec 27 06:59:23 2006
@@ -216,7 +216,10 @@
FileHandle XMLPlatformUtils::openFile(const char* const fileName
, MemoryManager* const manager)
{
- return (FileHandle) open( fileName , O_RDONLY | O_LARGEFILE);
+ int f = open( fileName , O_RDONLY | O_LARGEFILE);
+ if(f==-1)
+ return 0;
+ return (FileHandle)f;
}
FileHandle XMLPlatformUtils::openFile(const XMLCh* const fileName
@@ -224,7 +227,7 @@
{
const char* tmpFileName = XMLString::transcode(fileName, manager);
ArrayJanitor<char> janText((char*)tmpFileName, manager);
- return (FileHandle) open( tmpFileName , O_RDONLY | O_LARGEFILE);
+ return openFile( tmpFileName, manager);
}
FileHandle XMLPlatformUtils::openFileToWrite(const XMLCh* const fileName
@@ -232,13 +235,16 @@
{
const char* tmpFileName = XMLString::transcode(fileName, manager);
ArrayJanitor<char> janText((char*)tmpFileName, manager);
- return (FileHandle)open( tmpFileName , O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 0666);
+ return openFile( tmpFileName, manager);
}
FileHandle XMLPlatformUtils::openFileToWrite(const char* const fileName
, MemoryManager* const manager)
{
- return (FileHandle)open( fileName , O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 0666);
+ int f=open( fileName , O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, 0666);
+ if(f==-1)
+ return 0;
+ return (FileHandle)f;
}
unsigned int
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org