Mailinglist Archive: zypp-commit (301 mails)

< Previous Next >
[zypp-commit] r7687 - in /trunk/libzypp/zypp: ZYppFactory.cc ZYppFactory.h
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Mon, 29 Oct 2007 15:46:50 -0000
  • Message-id: <20071029154651.2D57A2FC62@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Mon Oct 29 16:46:50 2007
New Revision: 7687

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7687&view=rev
Log:
- include locker pid in ZYppFactoryException (see bug #191147)

Modified:
trunk/libzypp/zypp/ZYppFactory.cc
trunk/libzypp/zypp/ZYppFactory.h

Modified: trunk/libzypp/zypp/ZYppFactory.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYppFactory.cc?rev=7687&r1=7686&r2=7687&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZYppFactory.cc (original)
+++ trunk/libzypp/zypp/ZYppFactory.cc Mon Oct 29 16:46:50 2007
@@ -63,6 +63,7 @@
ZYppGlobalLock()
: _clean_lock(false)
, _zypp_lockfile(0)
+ , _locker_pid(0)
{}

~ZYppGlobalLock()
@@ -89,10 +90,13 @@
catch(...) {} // let no exception escape.
}

+ pid_t locker_pid() const { return _locker_pid; }
+
bool _clean_lock;

private:
FILE *_zypp_lockfile;
+ pid_t _locker_pid;

void openLockFile(const char *mode)
{
@@ -173,13 +177,13 @@
pid_t lockerPid()
{
pid_t curr_pid = getpid();
- pid_t locked_pid = 0;
+ pid_t locker_pid = 0;
long readpid = 0;

fscanf(_zypp_lockfile, "%ld", &readpid);
MIL << "read: Lockfile " << ZYPP_LOCK_FILE << " has pid " << readpid <<
" (our pid: " << curr_pid << ") "<< std::endl;
- locked_pid = (pid_t) readpid;
- return locked_pid;
+ locker_pid = (pid_t) readpid;
+ return locker_pid;
}

public:
@@ -196,7 +200,8 @@
shLockFile();

pid_t locker_pid = lockerPid();
- if ( locker_pid == curr_pid )
+ _locker_pid = locker_pid;
+ if ( locker_pid == curr_pid )
{
// alles ok, we are requesting the instance again
//MIL << "Lockfile found, but it is myself. Assuming same process
getting zypp instance again." << std::endl;
@@ -275,8 +280,9 @@
//
///////////////////////////////////////////////////////////////////

- ZYppFactoryException::ZYppFactoryException( const std::string & msg_r )
- : Exception(N_("Software management is already running."))
+ ZYppFactoryException::ZYppFactoryException( const std::string & msg_r, pid_t
locker_pid )
+ : Exception(N_("Software management is already running.")),
+ _locker_pid (locker_pid)
{}

///////////////////////////////////////////////////////////////////
@@ -331,7 +337,8 @@
/*--------------------------------------------------*/
if ( globalLock.zyppLocked() )
{
- ZYPP_THROW( ZYppFactoryException(N_("Software management is already
running.")) );
+ ZYPP_THROW( ZYppFactoryException(N_("Software management is already
running."),
+ globalLock.locker_pid()) );
}
else
{

Modified: trunk/libzypp/zypp/ZYppFactory.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZYppFactory.h?rev=7687&r1=7686&r2=7687&view=diff
==============================================================================
--- trunk/libzypp/zypp/ZYppFactory.h (original)
+++ trunk/libzypp/zypp/ZYppFactory.h Mon Oct 29 16:46:50 2007
@@ -24,7 +24,10 @@
class ZYppFactoryException : public Exception
{
public:
- ZYppFactoryException( const std::string & msg_r );
+ ZYppFactoryException( const std::string & msg_r, pid_t locker_pid );
+ pid_t locker_pid() const { return _locker_pid; }
+ private:
+ pid_t _locker_pid;
};

///////////////////////////////////////////////////////////////////

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages