(file) Return to TraceFileHandler.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/TraceFileHandler.cpp between version 1.28 and 1.33

version 1.28, 2006/04/18 19:08:42 version 1.33, 2008/05/07 19:41:42
Line 29 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Sushma Fernandes, Hewlett-Packard Company (sushma_fernandes@hp.com)  
 //  
 // Modified By: Rudy Schuet (rudy.schuet@compaq.com) 11/12/01  
 //              added nsk platform support  
 //              Amit K Arora, IBM (amita@in.ibm.com) for Bug#1527  
 //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)  
 //              Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com)  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 //#include <fstream>  
 //#include <iostream>  
 #include <Pegasus/Common/FileSystem.h> #include <Pegasus/Common/FileSystem.h>
 #include <Pegasus/Common/TraceFileHandler.h> #include <Pegasus/Common/TraceFileHandler.h>
  
 #if defined(PEGASUS_OS_TYPE_WINDOWS) #if defined(PEGASUS_OS_TYPE_WINDOWS)
 # include <Pegasus/Common/TraceFileHandlerWindows.cpp> # include <Pegasus/Common/TraceFileHandlerWindows.cpp>
 #elif defined(PEGASUS_OS_TYPE_UNIX)  #elif defined(PEGASUS_OS_TYPE_UNIX) || defined(PEGASUS_OS_VMS)
 # include <Pegasus/Common/TraceFileHandlerUnix.cpp>  # include <Pegasus/Common/TraceFileHandlerPOSIX.cpp>
 #elif defined(PEGASUS_OS_TYPE_NSK)  
 # include <Pegasus/Common/TraceFileHandlerNsk.cpp>  
 #elif defined(PEGASUS_OS_VMS)  
 # include <Pegasus/Common/TraceFileHandlerVms.cpp>  
 #else #else
 # error "Unsupported platform" # error "Unsupported platform"
 #endif #endif
Line 145 
Line 131 
     if (!fileHandle)     if (!fileHandle)
     {     {
         // Unable to open file, log a message         // Unable to open file, log a message
         Logger::put_l(Logger::DEBUG_LOG, System::CIMSERVER, Logger::WARNING,          Logger::put_l(
               Logger::ERROR_LOG,
               System::CIMSERVER,
               Logger::WARNING,
             "Common.TraceFileHandler.FAILED_TO_OPEN_FILE",             "Common.TraceFileHandler.FAILED_TO_OPEN_FILE",
             "Failed to open file $0", fileName);              "Failed to open file $0",
               fileName);
         return 0;         return 0;
     }     }
  
Line 175 
Line 165 
             String(fileName), (_S_IREAD|_S_IWRITE)) )             String(fileName), (_S_IREAD|_S_IWRITE)) )
 #endif #endif
     {     {
         Logger::put_l(Logger::DEBUG_LOG, System::CIMSERVER, Logger::WARNING,          Logger::put_l(
               Logger::ERROR_LOG,
               System::CIMSERVER,
               Logger::WARNING,
            "Common.TraceFileHandler.FAILED_TO_SET_FILE_PERMISSIONS",            "Common.TraceFileHandler.FAILED_TO_SET_FILE_PERMISSIONS",
            "Failed to set permissions on file $0", fileName);             "Failed to set permissions on file $0",
               fileName);
         fclose(fileHandle);         fclose(fileHandle);
         return 0;         return 0;
     }     }
Line 193 
Line 187 
     FileSystem::translateSlashes(fileName);     FileSystem::translateSlashes(fileName);
     if (FileSystem::isDirectory(fileName))     if (FileSystem::isDirectory(fileName))
     {     {
         return 0;          return false;
     }     }
  
     // Check if the file exists and is writable     // Check if the file exists and is writable
     if (FileSystem::exists(fileName))     if (FileSystem::exists(fileName))
     {     {
         if (!FileSystem::canWrite(fileName))          return FileSystem::canWrite(fileName);
         {  
             return 0;  
         }  
         else  
         {  
             return 1;  
         }         }
     }  
     else  
     {  
         // Check if directory is writable         // Check if directory is writable
         Uint32 index = fileName.reverseFind('/');         Uint32 index = fileName.reverseFind('/');
  
         if (index != PEG_NOT_FOUND)         if (index != PEG_NOT_FOUND)
         {         {
             String dirName = fileName.subString(0,index);             String dirName = fileName.subString(0,index);
             if (!FileSystem::isDirectory(dirName))  
           if (dirName.size() == 0)
             {             {
                 return 0;              dirName = "/";
             }             }
             if (!FileSystem::canWrite(dirName) )  
             {          if (!FileSystem::isDirectory(dirName))
                 return 0;  
             }  
             else  
             {             {
                 return 1;              return false;
             }             }
   
           return FileSystem::canWrite(dirName);
         }         }
         else  
         {  
             String currentDir;             String currentDir;
  
             // Check if there is permission to write in the             // Check if there is permission to write in the
             // current working directory             // current working directory
             FileSystem::getCurrentDirectory(currentDir);             FileSystem::getCurrentDirectory(currentDir);
  
             if (!FileSystem::canWrite(currentDir))      return FileSystem::canWrite(currentDir);
             {  
                 return 0;  
             }  
             else  
             {  
                 return 1;  
             }  
         }  
     }  
     PEGASUS_UNREACHABLE(return 1;)  
 } }
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.28  
changed lines
  Added in v.1.33

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2