If cwd got unlinked, "." is open-able, because the directory inode
is still used by the process.  getcwd() raises ENOENT in this case.
---
 yummain.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/yummain.py b/yummain.py
index 12582d2..5b8b600 100755
--- a/yummain.py
+++ b/yummain.py
@@ -101,12 +101,13 @@ def main(args):
     except Errors.YumBaseError, e:
         return exFatal(e)
 
-    # Try to open the current directory to see if we have 
+    # Try to open the current directory to see if it exists and we have
     # read and execute access. If not, chdir to /
     try:
+        os.getcwd()
         f = open(".")
-    except IOError, e:
-        if e.errno == errno.EACCES:
+    except (OSError, IOError), e:
+        if e.errno in (errno.ENOENT, errno.EACCES):
             logger.critical(_('No read/execute access in current directory, 
moving to /'))
             os.chdir("/")
     else:
-- 
1.7.4.4

_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to