[10281] in bugtraq
Re: truncate("x", -1)
daemon@ATHENA.MIT.EDU (Chris Wedgwood)
Tue Apr 20 14:10:32 1999
Date: Tue, 20 Apr 1999 07:41:20 +1200
Reply-To: Chris Wedgwood <cw@IX.NET.NZ>
From: Chris Wedgwood <cw@IX.NET.NZ>
X-To: David Luyer <luyer@ucs.uwa.edu.au>
To: BUGTRAQ@NETSPACE.ORG
In-Reply-To: <199904190601.OAA31507@typhaon.ucs.uwa.edu.au>; from David Luyer
on Mon, Apr 19, 1999 at 02:01:08PM +0800
On Mon, Apr 19, 1999 at 02:01:08PM +0800, David Luyer wrote:
> The argument to [f]truncate is meant to be a size_t not a ssize_t, so
> probably this is a signed/unsigned bug. The man page says that it should
> truncate a file to at most the specified size, so the correct behaviour
> should be
>
> truncate("x", -1)
> kernel: current size 0 < new size 2^32 - 1
> kernel: return success with no action
2.0.x gets messed up. I've sent a patch to bugtraq and AlanC which I
took from 2.2.x, so hopefully 2.0.37 will be OK.
2.2.6 is fine.
-cw