summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/cacache/lib/util/fix-owner.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/cacache/lib/util/fix-owner.js')
-rw-r--r--deps/npm/node_modules/cacache/lib/util/fix-owner.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/deps/npm/node_modules/cacache/lib/util/fix-owner.js b/deps/npm/node_modules/cacache/lib/util/fix-owner.js
index c91c709d95..f5c33db5f0 100644
--- a/deps/npm/node_modules/cacache/lib/util/fix-owner.js
+++ b/deps/npm/node_modules/cacache/lib/util/fix-owner.js
@@ -37,9 +37,15 @@ function fixOwner (cache, filepath) {
// This platform doesn't need ownership fixing
return BB.resolve()
}
+
+ getSelf()
+ if (self.uid !== 0) {
+ // almost certainly can't chown anyway
+ return BB.resolve()
+ }
+
return BB.resolve(inferOwner(cache)).then(owner => {
const { uid, gid } = owner
- getSelf()
// No need to override if it's already what we used.
if (self.uid === uid && self.gid === gid) {