diff options
author | isaacs <i@izs.me> | 2011-10-12 22:11:47 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-10-12 22:11:47 +0400 |
commit | c0df906b4f35d5f8ab74eb345f695ce53aff938d (patch) | |
tree | 22a079502df0658f3e0acb4acdcc069fb4d73963 /lib | |
parent | dd7359a5d275c659bdcfb17c26314cb13ec37e57 (diff) |
Apply umask correctly, completely, and remove all literal mode values
Diffstat (limited to 'lib')
-rw-r--r-- | lib/build.js | 2 | ||||
-rw-r--r-- | lib/utils/mkdir-p.js | 2 | ||||
-rw-r--r-- | lib/utils/npm-registry-client/get.js | 2 | ||||
-rw-r--r-- | lib/utils/tar.js | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/build.js b/lib/build.js index 73050454c..00e03af5a 100644 --- a/lib/build.js +++ b/lib/build.js @@ -144,7 +144,7 @@ function linkBins (pkg, folder, parent, gtop, cb) { if (er) return cb(er) // bins should always be executable. // XXX skip chmod on windows? - fs.chmod(path.resolve(folder, pkg.bin[b]), 0755, function (er) { + fs.chmod(path.resolve(folder, pkg.bin[b]), npm.modes.exec, function (er) { if (er || !gtop) return cb(er) var dest = path.resolve(binRoot, b) , src = path.resolve(folder, pkg.bin[b]) diff --git a/lib/utils/mkdir-p.js b/lib/utils/mkdir-p.js index 6fe169d12..e2a874d1a 100644 --- a/lib/utils/mkdir-p.js +++ b/lib/utils/mkdir-p.js @@ -14,7 +14,7 @@ module.exports = mkdir function mkdir (ensure, mode, uid, gid, cb_) { if (typeof cb_ !== "function") cb_ = gid, gid = null if (typeof cb_ !== "function") cb_ = uid, uid = null - if (typeof cb_ !== "function") cb_ = mode, mode = 0755 + if (typeof cb_ !== "function") cb_ = mode, mode = npm.modes.exec if (mode & umask) { log.verbose(mode.toString(8), "umasking from "+umask.toString(8)) diff --git a/lib/utils/npm-registry-client/get.js b/lib/utils/npm-registry-client/get.js index 7a4453900..206077c81 100644 --- a/lib/utils/npm-registry-client/get.js +++ b/lib/utils/npm-registry-client/get.js @@ -159,7 +159,7 @@ function saveToCache (cache, data, saved) { } function saveToCache_ (cache, data, uid, gid, saved) { - mkdir(path.dirname(cache), 0755, uid, gid, function (er) { + mkdir(path.dirname(cache), npm.modes.exec, uid, gid, function (er) { if (er) return saved() fs.writeFile(cache, JSON.stringify(data), function (er) { if (er || uid === null || gid === null) { diff --git a/lib/utils/tar.js b/lib/utils/tar.js index c5ef8e06d..52a57bf45 100644 --- a/lib/utils/tar.js +++ b/lib/utils/tar.js @@ -227,7 +227,7 @@ function gunzTarPerm (tarball, tmp, dMode, fMode, uid, gid, cb) { if (er) return cb(er) var mode = stat.isDirectory() ? dMode : fMode , oldMode = stat.mode & 0777 - , newMode = (oldMode | mode) & (~(process.umask() || 022)) + , newMode = (oldMode | mode) & (~npm.modes.umask) if (mode && newMode !== oldMode) { log.silly(newMode.toString(8), "chmod "+path.basename(f)) fs.chmod(f, newMode, cb) |