diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2016-10-25 17:07:19 -0700 |
---|---|---|
committer | Jeremiah Senkpiel <fishrock123@rocketmail.com> | 2016-11-04 17:51:05 -0400 |
commit | 379097850d714494b3cfb92803d79d9999c983ef (patch) | |
tree | 08fc64801758d6239872540e05e0e6952cd40c8c /deps/npm/node_modules/graceful-fs/polyfills.js | |
parent | 1a55e9a5672ec654a6cfdd694c20b7067368f5e9 (diff) | |
download | android-node-v8-379097850d714494b3cfb92803d79d9999c983ef.tar.gz android-node-v8-379097850d714494b3cfb92803d79d9999c983ef.tar.bz2 android-node-v8-379097850d714494b3cfb92803d79d9999c983ef.zip |
deps: upgrade npm to 3.10.9
PR-URL: https://github.com/nodejs/node/pull/9286
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/node_modules/graceful-fs/polyfills.js')
-rw-r--r-- | deps/npm/node_modules/graceful-fs/polyfills.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/deps/npm/node_modules/graceful-fs/polyfills.js b/deps/npm/node_modules/graceful-fs/polyfills.js index 2798050604..cf474df73f 100644 --- a/deps/npm/node_modules/graceful-fs/polyfills.js +++ b/deps/npm/node_modules/graceful-fs/polyfills.js @@ -56,6 +56,14 @@ function patch (fs) { fs.fchmodSync = chmodFixSync(fs.fchmodSync) fs.lchmodSync = chmodFixSync(fs.lchmodSync) + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + // if lchmod/lchown do not exist, then make them no-ops if (!fs.lchmod) { fs.lchmod = function (path, mode, cb) { @@ -246,6 +254,33 @@ function chownFixSync (orig) { } } + +function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, cb) { + return orig.call(fs, target, function (er, stats) { + if (!stats) return cb.apply(this, arguments) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + if (cb) cb.apply(this, arguments) + }) + } +} + +function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target) { + var stats = orig.call(fs, target) + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + return stats; + } +} + // ENOSYS means that the fs doesn't support the op. Just ignore // that, because it doesn't matter. // |