Email List: Xaustin-review-lX
[All Lists]

Defect in XSH ftruncate

To: yyyyyyyyyyyyyyy@xxxxxxxxxxxxx
Subject: Defect in XSH ftruncate
From: Geoff Clare <yyy@xxxxxxxxxxxxx>
Date: Tue, 16 Dec 2003 10:27:56 +0000
@ page 458-459 line 15060-15067 section ftruncate objection [gwc ftruncate 
errors]

Defect code :  1. Error

The ERRORS section on the ftruncate page has a number of problems.

1. The EFBIG error for exceeding the offset maximum should not be
shaded XSI.

2. The last EINVAL error is redundant.  The condition is "The fildes
argument references a file that was opened without write permission."
This effectively means fildes is not open for writing, which is
already listed as "[EBADF] or [EINVAL]".

3. The EROFS error should not be there.  It was added in SUSv2, but
I believe that adding it was a mistake.  A file on a read-only file
system cannot be opened for writing, so the fd passed to ftruncate()
would not be open for writing and the proper error value for this
situation is EBADF.  In SUSv2 ftruncate() and truncate() were both
described on the same page, and EROFS is valid for truncate(), so
that may have had something to do with why the mistake was made.

4. No error value is listed for the case where ftruncate() fails
because the file is smaller that the specified size.  (On non-XSI
systems it can either increase the file size or fail.)  Presumably
the appropriate error value is EINVAL.

Action:

1. Remove the XSI shading from the EFBIG error on lines 15060-15061.

2. Delete lines 15065-15066:

   [EINVAL]    The fildes argument references a file that was opened
               without write permission.

3. Delete line 15067:

   [EROFS]     The named file resides on a read-only file system.

4. Add after line 15067:

   The ftruncate() function may fail if:

   [EINVAL]    The fildes argument references a regular file and the
               length argument is greater than the current size of the
               file, and the implementation does not support the XSI
               option.

<Prev in Thread] Current Thread [Next in Thread>
  • Defect in XSH ftruncate, Geoff Clare <=