Imported Upstream version 14.45.0
[platform/upstream/libzypp.git] / zypp / base / LogControl.cc
index 7732634..03080bb 100644 (file)
@@ -46,17 +46,19 @@ namespace zypp
       }
       else
       {
+       if ( mode_r )
+       {
+          // not filesystem::assert_file as filesystem:: functions log,
+         // and this FileWriter is not yet in place.
+         int fd = ::open( file_r.c_str(), O_CREAT|O_EXCL, mode_r );
+         if ( fd != -1 )
+           ::close( fd );
+       }
         // set unbuffered write
         std::ofstream * fstr = 0;
         _outs.reset( (fstr = new std::ofstream( file_r.asString().c_str(), std::ios_base::app )) );
         fstr->rdbuf()->pubsetbuf(0,0);
         _str = &(*fstr);
-        if ( mode_r )
-        {
-          // not filesystem::chmod, as filesystem:: functions log,
-          // and this FileWriter is not yet in place.
-          ::chmod( file_r.asString().c_str(), mode_r );
-        }
       }
     }
 
@@ -145,6 +147,8 @@ namespace zypp
         /** */
         virtual int writeout( const char* s, std::streamsize n )
         {
+         //logger::putStream( _group, _level, _file, _func, _line, _buffer );
+         //return n;
           if ( s && n )
             {
               const char * c = s;