On 08/04/2012 10:06 AM, Jim Meyering wrote: > FYI, > >>From 0ee727e612ae202e5b47e39062f6604d65a76074 Mon Sep 17 00:00:00 2001 > From: Jim Meyering <[email protected]> > Date: Sat, 4 Aug 2012 11:02:40 +0200 > Subject: [PATCH] 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. > Reverse conjuncts, so the close is unconditional. > Spotted by coverity.
Cool. Not worth a news entry because we exit() right after (as file_size will be left at -1 in this case). Hmm, but I just noticed that close() may clear the errno of an lseek() failure, so we'd get the classic "Error: success" in this case? cheers, Pádraig.
