]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(Open-time Flags): Say POSIX.1 requires write access for O_TRUNC.
authorRoland McGrath <roland@gnu.org>
Wed, 26 Oct 1994 05:35:04 +0000 (05:35 +0000)
committerRoland McGrath <roland@gnu.org>
Wed, 26 Oct 1994 05:35:04 +0000 (05:35 +0000)
Say O_TRUNC is no better than ftruncate and only historical.

manual/llio.texi

index aae7b0e1aa79bee089356ba32557001cf024c598..2cb0151bba21125284dc7499faccc275133860e8 100644 (file)
@@ -1407,12 +1407,16 @@ can do them @i{atomically}.
 @comment POSIX.1
 @deftypevr Macro int O_TRUNC
 Truncate the file to zero length.  This option is only useful for
-regular files, not special files such as directories or FIFOs.  You have
-permission to write the file to truncate it, but you need not open for
-write access.
-
-This is the only open-time action flag specified by POSIX.1.
-@c !!! not atomic? check posix.1
+regular files, not special files such as directories or FIFOs.  POSIX.1
+requires that you open the file for writing to use @code{O_TRUNC}.  In
+BSD and GNU you must have permission to write the file to truncate it,
+but you need not open for write access.
+
+This is the only open-time action flag specified by POSIX.1.  There is
+no good reason for truncation to be done by @code{open}, instead of by
+calling @code{ftruncate} afterwards.  The @code{O_TRUNC} flag existed in
+Unix before @code{ftruncate} was invented, and is retained for backward
+compatibility.
 @end deftypevr
 
 @comment fcntl.h