Re: ftruncate not extending files?

Malcolm Beattie (mbeattie@sable.ox.ac.uk)
Fri, 2 Mar 2001 09:57:02 +0000


bert hubert writes:
> I would've sworn, based on the fact that I saw people do it, that ftruncate
> was a legitimate way to extend a file

Well it's not SuSv2 standards compliant:

http://www.opengroup.org/onlinepubs/007908799/xsh/ftruncate.html

If the file previously was larger 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. If
^^^^^^^^^^^
the file is extended, the extended area appears as if it were
zero-filled.

How "legitimate" relates to "SuSv2 standards compliant" is your call.

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Unix Systems Programmer
Oxford University Computing Services
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/