diff options
author | Bruno Jouhier <bjouhier@gmail.com> | 2015-02-07 19:27:20 +0100 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2015-02-17 12:09:20 -0500 |
commit | b3aa876f08563aaed1b51a9dc5c1a254a146af67 (patch) | |
tree | 62a0c1242554cd0cad53cf811b0a961c17fd1914 /lib | |
parent | 7b554024cca6b3d5b7922c510ddf877dcfaba97f (diff) | |
download | node-b3aa876f08563aaed1b51a9dc5c1a254a146af67.tar.gz |
fs: properly handle fd passed to truncate()
Currently, fs.truncate() silently fails when a file descriptor
is passed as the first argument. This commit changes this
behavior to properly call fs.ftruncate().
PR-URL: https://github.com/joyent/node/pull/9161
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fs.js | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -639,9 +639,7 @@ fs.renameSync = function(oldPath, newPath) { fs.truncate = function(path, len, callback) { if (util.isNumber(path)) { - var req = new FSReqWrap(); - req.oncomplete = callback; - return fs.ftruncate(path, len, req); + return fs.ftruncate(path, len, callback); } if (util.isFunction(len)) { callback = len; |