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.
This commit is contained in:
parent
11d4c4ca62
commit
29c0df4fcc
|
@ -9,9 +9,9 @@ var needPermissionsFixed = [
|
||||||
path.join(__dirname, "..", "google-drive-subtitles")
|
path.join(__dirname, "..", "google-drive-subtitles")
|
||||||
];
|
];
|
||||||
|
|
||||||
function fixPermissions(uid, gid) {
|
function fixPermissions(user, group) {
|
||||||
uid = resolveUid(uid);
|
var uid = resolveUid(user);
|
||||||
gid = resolveGid(uid);
|
var gid = resolveGid(group);
|
||||||
needPermissionsFixed.forEach(function (dir) {
|
needPermissionsFixed.forEach(function (dir) {
|
||||||
if (fs.existsSync(dir)) {
|
if (fs.existsSync(dir)) {
|
||||||
fs.chownSync(dir, uid, gid);
|
fs.chownSync(dir, uid, gid);
|
||||||
|
@ -19,12 +19,12 @@ function fixPermissions(uid, gid) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveUid(uid) {
|
function resolveUid(user) {
|
||||||
return parseInt(execSync('id -u ' + uid), 10);
|
return parseInt(execSync('id -u ' + user), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveGid(uid) {
|
function resolveGid(group) {
|
||||||
return parseInt(execSync('id -g ' + uid), 10);
|
return parseInt(execSync('id -g ' + group), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.get("setuid.enabled")) {
|
if (Config.get("setuid.enabled")) {
|
||||||
|
|
Loading…
Reference in a new issue