pid_t lockerPid()
{
+ pid_t curr_pid = getpid();
pid_t locked_pid = 0;
long readpid = 0;
fscanf(_zypp_lockfile, "%ld", &readpid);
- MIL << "read: Lockfile " << ZYPP_LOCK_FILE << " has pid " << readpid << std::endl;
+ MIL << "read: Lockfile " << ZYPP_LOCK_FILE << " has pid " << readpid << " (our pid: " << curr_pid << ") "<< std::endl;
locked_pid = (pid_t) readpid;
return locked_pid;
}
if ( lockFileExists() )
{
+ MIL << "found lockfile " << lock_file << std::endl;
openLockFile("r");
shLockFile();
}
else
{
+ MIL << "no lockfile " << lock_file << " found" << std::endl;
if ( geteuid() == 0 )
{
+ MIL << "running as root. Will attempt to create " << lock_file << std::endl;
createLockFile();
// now open it for reading
openLockFile("r");
shLockFile();
}
+ else
+ {
+ MIL << "running as user. Skipping creating " << lock_file << std::endl;
+ }
return false;
}
return true;
}
- std::string fakearch(getenv("ZYPP_TESTSUITE_FAKE_ARCH"));
- if ( fakearch.size() > 0 )
+
+ if ( getenv("ZYPP_TESTSUITE_FAKE_ARCH") )
{
- _architecture = Arch( fakearch );
- MIL << "ZYPP_TESTSUITE_FAKE_ARCH: Setting fake system architecture for test purpuses (warning! commit will be disabled!) to: '" << _architecture << "'" << endl;
+ Arch already_set = _architecture;
+
+ std::string fakearch(getenv("ZYPP_TESTSUITE_FAKE_ARCH"));
+ try
+ {
+ _architecture = Arch( fakearch );
+ MIL << "ZYPP_TESTSUITE_FAKE_ARCH: Setting fake system architecture for test purpuses (warning! commit will be disabled!) to: '" << _architecture << "'" << endl;
+ }
+ catch(...)
+ {
+ ERR << "ZYPP_TESTSUITE_FAKE_ARCH: Wrong architecture specified on env variable, using: '" << _architecture << "'" << endl;
+ }
}
}