Subject: Re: ftruncate(2) and length bigger than filesize
To: None <firstname.lastname@example.org>
From: PER4MANCE, J. Dolecek <email@example.com>
Date: 04/20/2000 18:36:01
Jason R Thorpe wrote:
> We should probably look up ftruncate(2) in SUSv2 and check. Tho, I
> agree that our behaviour should at least be consistent.
Good pointer. SUSv2 says ftruncate() sets the size of file
to specified length, ie. shortens or lengthens the file size
Seems like the only filesystems which does support setattr()/ftruncate()
and doesn't set the file size to given value is lfs. nfs, ffs,
ext2fs, msdosfs (and hence all "layered" filesystems) seem to set
the file length to given length.
So fixing lfs to also enlarge the file in ftruncate() if needed
is much less work and we gain SUSv2 compliance, even :)