From 338dc567385c5dd247c80f60b663bb6c6894adae Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 1 Sep 2010 09:00:48 -0700 Subject: [PATCH] Make atomic directory creation code in dblink.mergeme() use equivalent error handling to portage.util.ensure_dirs(). --- pym/portage/dbapi/vartree.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 45ed955ed..25956f198 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -3619,8 +3619,14 @@ class dblink(object): else: os.mkdir(mydest) except OSError as e: - if e.errno not in (errno.EEXIST, errno.EISDIR): - # Bug 187518 - sometimes mkdir raises EISDIR on FreeBSD + # Error handling should be equivalent to + # portage.util.ensure_dirs() for cases + # like bug #187518. + if e.errno in (errno.EEXIST,): + pass + elif os.path.isdir(mydest): + pass + else: raise del e @@ -3637,8 +3643,14 @@ class dblink(object): else: os.mkdir(mydest) except OSError as e: - if e.errno not in (errno.EEXIST, errno.EISDIR): - # Bug 187518 - sometimes mkdir raises EISDIR on FreeBSD + # Error handling should be equivalent to + # portage.util.ensure_dirs() for cases + # like bug #187518. + if e.errno in (errno.EEXIST,): + pass + elif os.path.isdir(mydest): + pass + else: raise del e os.chmod(mydest, mystat[0]) -- 2.26.2