[Yum-devel] [PATCH] if we lock and selinux (or something) keeps us from even accessing the lockfile/dir we shouldn't trace back but generate a nice-ish lock error.

Seth Vidal skvidal at fedoraproject.org
Thu Jul 22 14:55:53 UTC 2010


https://bugzilla.redhat.com/show_bug.cgi?id=617170
---
 yum/__init__.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index 0b3f627..6ca40ee 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1580,7 +1580,12 @@ class YumBase(depsolve.Depsolve):
         
         mypid=str(os.getpid())    
         while not self._lock(lockfile, mypid, 0644):
-            fd = open(lockfile, 'r')
+            try:
+                fd = open(lockfile, 'r')
+            except (IOError, OSError), e:
+                msg = _("Could not open lock %s: %s") % (lockfile, e)
+                raise Errors.LockError(1, msg)
+                
             try: oldpid = int(fd.readline())
             except ValueError:
                 # bogus data in the pid file. Throw away.
-- 
1.7.1.1



More information about the Yum-devel mailing list