From e2ee043f68367bd79b2e8d1b8781f3470a405969 Mon Sep 17 00:00:00 2001 From: Patrick Vos <itofzo@gmail.com> Date: Sun, 22 Apr 2012 18:12:38 +0200 Subject: [PATCH] fix unicode in chmodAsParent and fixSetGroupID --- sickbeard/helpers.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 67d9324db..359154068 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -443,7 +443,9 @@ def chmodAsParent(childPath): return parentMode = stat.S_IMODE(os.stat(parentPath)[stat.ST_MODE]) - childPath_mode = stat.S_IMODE(os.stat(childPath)[stat.ST_MODE]) + + childPathStat = ek.ek(os.stat, childPath) + childPath_mode = stat.S_IMODE(childPathStat[stat.ST_MODE]) if ek.ek(os.path.isfile, childPath): childMode = fileBitFilter(parentMode) @@ -453,7 +455,7 @@ def chmodAsParent(childPath): if childPath_mode == childMode: return - childPath_owner = os.stat(childPath).st_uid + childPath_owner = childPathStat.st_uid user_id = os.geteuid() if user_id !=0 and user_id != childPath_owner: @@ -477,18 +479,20 @@ def fixSetGroupID(childPath): if os.name == 'nt' or os.name == 'ce': return + childStat = ek.ek(os.stat, childPath) + parentPath = ek.ek(os.path.dirname, childPath) parentStat = os.stat(parentPath) parentMode = stat.S_IMODE(parentStat[stat.ST_MODE]) if parentMode & stat.S_ISGID: parentGID = parentStat[stat.ST_GID] - childGID = os.stat(childPath)[stat.ST_GID] + childGID = childStat[stat.ST_GID] if childGID == parentGID: return - childPath_owner = os.stat(childPath).st_uid + childPath_owner = childStat.st_uid user_id = os.geteuid() if user_id !=0 and user_id != childPath_owner: -- GitLab