2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
5 POSIX.1-2008 function truncate().
12 /*****************************************************************************
24 Truncate a file to a specified length
27 path - the path of the file being truncated
28 lenght - The file will have at most this size
31 0 on success or -1 on errorr.
34 If the file previously was larger than this size, the extra data
35 is lost. If the file previously was shorter, it is
36 unspecified whether the file is left unchanged or is
37 extended. In the latter case the extended part reads as
50 ******************************************************************************/
54 if (!path
) /* safety check */
60 if ((fd
= open(path
, O_WRONLY
)) != -1)
62 ret
= ftruncate(fd
, length
);