From: Zac Medico Date: Mon, 30 Jul 2007 04:26:52 +0000 (-0000) Subject: Fix cacheddir() to behave properly if os.listdir() raises errno.EACCES (Permission... X-Git-Tag: v2.1.2.11~49 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7018f3627812e4787d274e875853407535a64ff2;p=portage.git Fix cacheddir() to behave properly if os.listdir() raises errno.EACCES (Permission denied). (branches/2.1.2 r6880) svn path=/main/branches/2.1.2.9/; revision=7468 --- diff --git a/pym/portage.py b/pym/portage.py index 0b6e3195e..2a153a298 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -193,7 +193,15 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli if mtime != cached_mtime or time.time() - mtime < 4: if dircache.has_key(mypath): cacheStale += 1 - list = os.listdir(mypath) + try: + list = os.listdir(mypath) + except EnvironmentError, e: + if e.errno != errno.EACCES: + raise + del e + if EmptyOnError: + return [], [] + raise portage_exception.PermissionDenied(mypath) ftype = [] for x in list: try: