Author: carnold
Date: Wed Nov 28 08:15:39 2007
New Revision: 599052

URL: http://svn.apache.org/viewvc?rev=599052&view=rev
Log:
LOGCXX-211: Crash(Segmentation Fault) in DailyRollingFileAppender when file 
change

Modified:
    logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp

Modified: logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp
URL: 
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp?rev=599052&r1=599051&r2=599052&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp (original)
+++ logging/log4cxx/trunk/src/main/cpp/fileoutputstream.cpp Wed Nov 28 08:15:39 
2007
@@ -53,11 +53,12 @@
 }
 
 void FileOutputStream::close(Pool& /* p */) {
-  apr_status_t stat = apr_file_close((apr_file_t*) fileptr);
-  if (stat == APR_SUCCESS) {
+  if (fileptr != NULL) {
+    apr_status_t stat = apr_file_close((apr_file_t*) fileptr);
+    if (stat != APR_SUCCESS) {
+        throw IOException(stat);
+    }
     fileptr = NULL;
-  } else {
-    throw IOException(stat);
   }
 }
 


Reply via email to