graceful-fs
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -5,3 +5,3 @@ { | ||
"description": "A drop-in replacement for fs, making various improvements.", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -119,2 +119,4 @@ var fs = require('./fs.js') | ||
// Chown should not fail on einval or eperm if non-root. | ||
// It should not fail on enosys ever, as this just indicates | ||
// that a fs doesn't support the intended operation. | ||
@@ -125,2 +127,6 @@ fs.chown = chownFix(fs.chown) | ||
fs.chmod = chownFix(fs.chmod) | ||
fs.fchmod = chownFix(fs.fchmod) | ||
fs.lchmod = chownFix(fs.lchmod) | ||
fs.chownSync = chownFixSync(fs.chownSync) | ||
@@ -130,2 +136,6 @@ fs.fchownSync = chownFixSync(fs.fchownSync) | ||
fs.chmodSync = chownFix(fs.chmodSync) | ||
fs.fchmodSync = chownFix(fs.fchmodSync) | ||
fs.lchmodSync = chownFix(fs.lchmodSync) | ||
function chownFix (orig) { | ||
@@ -152,11 +162,28 @@ if (!orig) return orig | ||
// ENOSYS means that the fs doesn't support the op. Just ignore | ||
// that, because it doesn't matter. | ||
// | ||
// 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. | ||
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 | ||
if (!er) | ||
return true | ||
if (er.code === "ENOSYS") | ||
return true | ||
var nonroot = !process.getuid || process.getuid() !== 0 | ||
if (nonroot) { | ||
if (er.code === "EINVAL" || er.code === "EPERM") | ||
return true | ||
} | ||
return false | ||
} | ||
@@ -163,0 +190,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14406
410