Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-09-10 23:53:44 +0400
committerisaacs <i@izs.me>2014-09-10 23:55:35 +0400
commit673d738c6142c3d043dcee0b7aa02c9831a2e0ca (patch)
tree618661febf8fe02e48feaecbaabba14dc9eb92c1 /lib/cache/add-local-tarball.js
parent734cc5c3de78fa2482863de08b1a4de1567bd7a3 (diff)
addLocalTarball: chown from the first created dir, not just the target dir
Diffstat (limited to 'lib/cache/add-local-tarball.js')
-rw-r--r--lib/cache/add-local-tarball.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/cache/add-local-tarball.js b/lib/cache/add-local-tarball.js
index bcb938fa9..211036d5d 100644
--- a/lib/cache/add-local-tarball.js
+++ b/lib/cache/add-local-tarball.js
@@ -191,7 +191,13 @@ function addTmpTarball_ (tgz, data, shasum, cb) {
var target = path.resolve(root, "package.tgz")
getCacheStat(function (er, cs) {
if (er) return cb(er)
- mkdir(pkg, function (er) {
+ mkdir(pkg, function (er, created) {
+
+ // chown starting from the first dir created by mkdirp
+ function chown () {
+ chownr(created, cs.uid, cs.gid, done)
+ }
+
if (er) return cb(er)
var read = fs.createReadStream(tgz)
var write = fs.createWriteStream(target)
@@ -199,9 +205,6 @@ function addTmpTarball_ (tgz, data, shasum, cb) {
read.on("error", cb).pipe(write).on("error", cb).on("close", fin)
})
- function chown () {
- chownr(root, cs.uid, cs.gid, done)
- }
})
function done() {