0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/lib
Olov Lassus c9207f7fc2 fs: fix corruption in writeFile and writeFileSync
1. writeFileSync bumps position incorrectly, causing it to drift in
iteration three and onwards.

2. Append mode files will get corrupted in the middle if writeFile or
writeFileSync iterates multiple times, unless running on Linux. position
starts out as null so first write is OK, but then position will refer to
a location inside an existing file, corrupting that data. Linux ignores
position for append mode files so it doesn't happen there.

This commit fixes these two related issues by bumping position correctly
and by always using null as the position argument to write/writeSync for
append mode files.

PR-URL: https://github.com/iojs/io.js/pull/1063
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2015-03-24 18:18:16 -07:00
..
_debug_agent.js
_debugger.js
_http_agent.js
_http_client.js
_http_common.js
_http_incoming.js
_http_outgoing.js
_http_server.js
_linklist.js
_stream_duplex.js
_stream_passthrough.js
_stream_readable.js
_stream_transform.js
_stream_wrap.js
_stream_writable.js
_tls_common.js
_tls_legacy.js
_tls_wrap.js
assert.js
buffer.js
child_process.js
cluster.js
console.js
constants.js
crypto.js
dgram.js
dns.js
domain.js
events.js
freelist.js
fs.js fs: fix corruption in writeFile and writeFileSync 2015-03-24 18:18:16 -07:00
http.js
https.js
module.js
net.js
os.js
path.js
process.js
punycode.js
querystring.js
readline.js
repl.js
smalloc.js
stream.js
string_decoder.js lib: use const to define constants 2015-01-21 16:21:31 -05:00
sys.js
timers.js
tls.js
tty.js
url.js
util.js
v8.js
vm.js
zlib.js