Author: matz Date: Tue Nov 25 20:20:25 2008 New Revision: 11803 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11803&view=rev Log: open with O_CREAT _must_ have a mode argument. Also the Fd ctor can throw, which would propagate up and hence never would reach all the nice fcntl() code. Now this somewhat works. Modified: trunk/libzypp/zypp/base/Fd.cc trunk/libzypp/zypp/base/Fd.h trunk/libzypp/zypp/base/InterProcessMutex.cc Modified: trunk/libzypp/zypp/base/Fd.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Fd.cc?rev=11803&r1=11802&r2=11803&view=diff ============================================================================== --- trunk/libzypp/zypp/base/Fd.cc (original) +++ trunk/libzypp/zypp/base/Fd.cc Tue Nov 25 20:20:25 2008 @@ -33,10 +33,10 @@ // METHOD NAME : Fd::Fd // METHOD TYPE : Ctor // - Fd::Fd( const Pathname & file_r, int open_flags ) + Fd::Fd( const Pathname & file_r, int open_flags, mode_t mode ) : m_fd( -1 ) { - m_fd = open( file_r.asString().c_str(), open_flags ); + m_fd = open( file_r.asString().c_str(), open_flags, mode ); if ( m_fd == -1 ) ZYPP_THROW_ERRNO_MSG( Exception, std::string("open ")+file_r.asString() ); } Modified: trunk/libzypp/zypp/base/Fd.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/Fd.h?rev=11803&r1=11802&r2=11803&view=diff ============================================================================== --- trunk/libzypp/zypp/base/Fd.h (original) +++ trunk/libzypp/zypp/base/Fd.h Tue Nov 25 20:20:25 2008 @@ -47,7 +47,7 @@ /** Ctor opens file. * \throw EXCEPTION If open fails. */ - Fd( const Pathname & file_r, int open_flags ); + Fd( const Pathname & file_r, int open_flags, mode_t mode = 0 ); /** Dtor closes file. */ ~Fd() Modified: trunk/libzypp/zypp/base/InterProcessMutex.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/InterProcessMutex.cc?rev=11803&r1=11802&r2=11803&view=diff ============================================================================== --- trunk/libzypp/zypp/base/InterProcessMutex.cc (original) +++ trunk/libzypp/zypp/base/InterProcessMutex.cc Tue Nov 25 20:20:25 2008 @@ -67,8 +67,12 @@ // try to create the lock file atomically, this will fail if // the lock exists - _fd.reset( new Fd( lock_file, O_RDWR | O_CREAT | O_EXCL) ); - if ( !_fd->isOpen() ) + try { + _fd.reset( new Fd( lock_file, O_RDWR | O_CREAT | O_EXCL, 0666) ); + } catch (...) { + _fd.reset(); + } + if ( !_fd || !_fd->isOpen() ) { struct flock lock; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org