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>2012-01-19 22:10:11 +0400
committerisaacs <i@izs.me>2012-01-19 22:10:11 +0400
commit511a7809805e911d71c4a7d51d71a29d18a0b0fd (patch)
treee36384a5eb72ab880314ac0ad8a1dbc228c7cb01 /node_modules
parent231fee20105968498904900da1d3f74668577269 (diff)
Update graceful-fs to 1.1.4
Diffstat (limited to 'node_modules')
-rw-r--r--node_modules/graceful-fs/graceful-fs.js42
-rw-r--r--node_modules/graceful-fs/package.json4
2 files changed, 44 insertions, 2 deletions
diff --git a/node_modules/graceful-fs/graceful-fs.js b/node_modules/graceful-fs/graceful-fs.js
index 7467f304a..bbabe6bc8 100644
--- a/node_modules/graceful-fs/graceful-fs.js
+++ b/node_modules/graceful-fs/graceful-fs.js
@@ -210,3 +210,45 @@ if (!fs.lutimes) {
fs.lutimesSync = function () {}
}
}
+
+
+// https://github.com/isaacs/node-graceful-fs/issues/4
+// Chown should not fail on einval or eperm if non-root.
+
+fs.chown = chownFix(fs.chown)
+fs.fchown = chownFix(fs.fchown)
+fs.lchown = chownFix(fs.lchown)
+
+fs.chownSync = chownFixSync(fs.chownSync)
+fs.fchownSync = chownFixSync(fs.fchownSync)
+fs.lchownSync = chownFixSync(fs.lchownSync)
+
+function chownFix (orig) {
+ return function (target, uid, gid, cb) {
+ return orig.call(fs, target, uid, gid, function (er, res) {
+ if (chownErOk(er)) er = null
+ cb(er, res)
+ })
+ }
+}
+
+function chownFixSync (orig) {
+ return function (target, uid, gid) {
+ try {
+ return orig.call(fs, target, uid, gid)
+ } catch (er) {
+ if (!chownErOk(er)) throw er
+ }
+ }
+}
+
+function chownErOk (er) {
+ // if there's no getuid, or if getuid() is something other than 0,
+ // and the error is EINVAL or EPERM, then just ignore it.
+ // This specific case is a silent failure in cp, install, tar,
+ // and most other unix tools that manage permissions.
+ // When running as root, or if other types of errors are encountered,
+ // then it's strict.
+ if (!er || (!process.getuid || process.getuid() !== 0)
+ && (er.code === "EINVAL" || er.code === "EPERM")) return true
+}
diff --git a/node_modules/graceful-fs/package.json b/node_modules/graceful-fs/package.json
index ec72affa1..f45a95fe7 100644
--- a/node_modules/graceful-fs/package.json
+++ b/node_modules/graceful-fs/package.json
@@ -2,14 +2,14 @@
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
"name": "graceful-fs",
"description": "fs monkey-patching to avoid EMFILE and other problems",
- "version": "1.1.2",
+ "version": "1.1.4",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-graceful-fs.git"
},
"main": "graceful-fs.js",
"engines": {
- "node": "0.4 || 0.5 || 0.6"
+ "node": ">=0.4.0"
},
"dependencies": {
"fast-list": "1"