diff options
author | Jim Meyering <meyering@redhat.com> | 2012-08-04 11:02:40 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-08-04 12:27:20 +0200 |
commit | cbd1cffa3eb9e6e5ca82ec67d3c4211a019dd1ed (patch) | |
tree | 3cbd529aad8b0af8c2f638dee9f07857fdeff9f2 /tests | |
parent | 4bee223d96fe34fd5290575ddb6eba7c9c7d7418 (diff) | |
download | coreutils-cbd1cffa3eb9e6e5ca82ec67d3c4211a019dd1ed.tar.xz |
truncate: don't leak a file descriptor with --ref=PIPE
* src/truncate.c (main): For a user who makes the mistake of
using a non-seekable file as a reference for the desired length,
truncate would open that file, attempt to seek to its end, but
upon seek failure would neglect to close the file descriptor.
Close the file descriptor even when lseek fails.
In addition, ignore failure to close that reference FD, since as
long as the lseek succeeds, a close failure doesn't matter.
Coverity spotted the potential FD leak.
Improved-by: Pádraig Brady.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions