Unverified Commit 148bc333 authored by James M Snell's avatar James M Snell
Browse files

fs: fixup negative length in fs.truncate

`fs.ftruncate`, `fsPromises.truncate`, and `fsPromises.ftruncate`
all adjust negative lengths to 0 before invoking the system call.
`fs.truncate()` was the one outlier.

This "fixes" https://github.com/nodejs/node/issues/35632

 but in the
opposite direction than discussed in the issue -- specifically by
removing an EINVAL error from one function rather than adding it to
another.

Signed-off-by: default avatarJames M Snell <jasnell@gmail.com>
Fixes: https://github.com/nodejs/node/issues/35632

PR-URL: https://github.com/nodejs/node/pull/37483


Reviewed-By: default avatarDarshan Sen <raisinten@gmail.com>
Reviewed-By: default avatarJuan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: default avatarLuigi Pinca <luigipinca@gmail.com>
parent ee6c467c
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment