diff options
Diffstat (limited to 'lib/fs.js')
-rw-r--r-- | lib/fs.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -543,7 +543,7 @@ fs.truncate = function(path, len, callback) { len = 0; } callback = maybeCallback(callback); - fs.open(path, 'w', function(er, fd) { + fs.open(path, 'r+', function(er, fd) { if (er) return callback(er); binding.ftruncate(fd, len, function(er) { fs.close(fd, function(er2) { @@ -562,7 +562,7 @@ fs.truncateSync = function(path, len) { len = 0; } // allow error to be thrown, but still close fd. - var fd = fs.openSync(path, 'w'); + var fd = fs.openSync(path, 'r+'); try { var ret = fs.ftruncateSync(fd, len); } finally { |