summaryrefslogtreecommitdiff
path: root/lib/fs.js
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2013-10-25 11:26:05 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2013-10-25 11:26:05 -0700
commit61ccaf9a974bedf54622a1d6ad6b6ad00f95f5a5 (patch)
tree1dc52d619bd9ad2424bae83d66c837e7eea6ba06 /lib/fs.js
parentf153d6da450b6ba5c78381e6e90a7ba243657691 (diff)
parent21265e20d3be515733418c5eef395ccec8f5f701 (diff)
downloadnodejs-61ccaf9a974bedf54622a1d6ad6b6ad00f95f5a5.tar.gz
nodejs-61ccaf9a974bedf54622a1d6ad6b6ad00f95f5a5.tar.bz2
nodejs-61ccaf9a974bedf54622a1d6ad6b6ad00f95f5a5.zip
Merge remote-tracking branch 'upstream/v0.10'
Conflicts: ChangeLog deps/uv/ChangeLog deps/uv/include/uv-darwin.h deps/uv/src/unix/fsevents.c deps/uv/src/unix/process.c deps/uv/src/version.c doc/api/addons.markdown doc/api/cluster.markdown doc/api/http.markdown lib/http.js lib/tls.js src/node_crypto.cc src/node_http_parser.cc src/node_version.h src/pipe_wrap.cc src/v8abbr.h src/v8ustack.d test/simple/test-http-pipeline-flood.js
Diffstat (limited to 'lib/fs.js')
-rw-r--r--lib/fs.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 0e915aaab..b92aa435b 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -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 {