[10271] in bugtraq
Re: truncate("x", -1)
daemon@ATHENA.MIT.EDU (Florian Weimer)
Tue Apr 20 14:10:09 1999
Date: Tue, 20 Apr 1999 08:46:48 +0200
Reply-To: Florian Weimer <fw@CYGNUS.STUTTGART.NETSURF.DE>
From: Florian Weimer <fw@CYGNUS.STUTTGART.NETSURF.DE>
X-To: David Luyer <luyer@UCS.UWA.EDU.AU>
To: BUGTRAQ@NETSPACE.ORG
In-Reply-To: David Luyer's message of "Mon, 19 Apr 1999 14:01:08 +0800"
David Luyer <luyer@UCS.UWA.EDU.AU> writes:
> 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
According to the Single UNIX specification, EINVAL should be returned
in this case, and Linux 2.2.6 does so.