diff options
author | isaacs <i@izs.me> | 2014-09-10 23:53:44 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-09-10 23:55:35 +0400 |
commit | 673d738c6142c3d043dcee0b7aa02c9831a2e0ca (patch) | |
tree | 618661febf8fe02e48feaecbaabba14dc9eb92c1 /lib/cache/add-local-tarball.js | |
parent | 734cc5c3de78fa2482863de08b1a4de1567bd7a3 (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.js | 11 |
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() { |