diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 67d9324db0b182ac5a2ad3a65de292d6d8638b23..359154068f7f3388da112bbfbf26e5a7dc89faaf 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: