From 29c0df4fccc9e31132b65574e9a546be152bed57 Mon Sep 17 00:00:00 2001 From: Lolcow Admin Date: Fri, 11 Dec 2015 00:20:40 -0500 Subject: [PATCH] Fix uid variable name duplication/ambiguity `uid` is used twice, where it should be `uid` and `gid`, resulting in an attempted execution of something like `id -g 1500` rather than `id -g syncgroup`. These variable names are already confusing due to the nature of the functions, so I made it clear they're strings rather than numeric IDs. --- src/setuid.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/setuid.js b/src/setuid.js index cece0e0a..8941adba 100644 --- a/src/setuid.js +++ b/src/setuid.js @@ -9,9 +9,9 @@ var needPermissionsFixed = [ path.join(__dirname, "..", "google-drive-subtitles") ]; -function fixPermissions(uid, gid) { - uid = resolveUid(uid); - gid = resolveGid(uid); +function fixPermissions(user, group) { + var uid = resolveUid(user); + var gid = resolveGid(group); needPermissionsFixed.forEach(function (dir) { if (fs.existsSync(dir)) { fs.chownSync(dir, uid, gid); @@ -19,12 +19,12 @@ function fixPermissions(uid, gid) { }); } -function resolveUid(uid) { - return parseInt(execSync('id -u ' + uid), 10); +function resolveUid(user) { + return parseInt(execSync('id -u ' + user), 10); } -function resolveGid(uid) { - return parseInt(execSync('id -g ' + uid), 10); +function resolveGid(group) { + return parseInt(execSync('id -g ' + group), 10); } if (Config.get("setuid.enabled")) {