Subject: Re: ftruncate(2) and length bigger than filesize
To: None <tech-kern@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 04/20/2000 09:56:18
On Thu, Apr 20, 2000 at 06:36:01PM +0200, PER4MANCE, J. Dolecek wrote:

 > Good pointer. SUSv2 says ftruncate() sets the size of file
 > to specified length, ie. shortens or lengthens the file size
 > as needed.

Actually, to quote:

	If the file previously was shorter than `length', the extra
	data is discarded.  If it was previously shorter than `length',
	it is unspecified whether the file is changed or its size
	increased.

So, technically, either behavior is correct.  However, I'm inclined to
make the behavior follow Solaris, consistently.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>