Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: fix partial write corruption in writeFile and writeFileSync #1063

Closed
wants to merge 1 commit into from

Commits on Mar 5, 2015

  1. fs: fix partial write 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.
    olov committed Mar 5, 2015
    Configuration menu
    Copy the full SHA
    9fc598b View commit details
    Browse the repository at this point in the history