summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Jouhier <bjouhier@gmail.com>2015-02-07 19:27:20 +0100
committercjihrig <cjihrig@gmail.com>2015-02-17 12:09:20 -0500
commitb3aa876f08563aaed1b51a9dc5c1a254a146af67 (patch)
tree62a0c1242554cd0cad53cf811b0a961c17fd1914 /lib
parent7b554024cca6b3d5b7922c510ddf877dcfaba97f (diff)
downloadnode-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.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 5345afa36..bd9fde680 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -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;