linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andries Brouwer <aebr@win.tue.nl>
To: Michael Kerrisk <mtk-lists@jambit.com>
Cc: aebr@win.tue.nl, linux-kernel@vger.kernel.org
Subject: Re: Bug in open() function (?)
Date: Thu, 17 Jul 2003 12:54:07 +0200	[thread overview]
Message-ID: <20030717125407.C2302@pclin040.win.tue.nl> (raw)
In-Reply-To: <008f01c34c38$9be3c120$c100a8c0@wakatipu>; from mtk-lists@jambit.com on Thu, Jul 17, 2003 at 09:54:11AM +0200

> >        O_TRUNC
> >               If  the  file  already exists and is a regular file
> >               and the open mode allows writing (i.e.,  is  O_RDWR
> >               or  O_WRONLY) it will be truncated to length 0.  If
> >               the file is a FIFO or  terminal  device  file,  the
> >               O_TRUNC  flag  is  ignored. Otherwise the effect of
> >               O_TRUNC is unspecified.
> 
> A late addition to this thread, but all of these systems DO truncate with
> 
> O_RDONLY | O_TRUNC:
> 
> Solaris 8
> Tru64 5.1B
> HP-UX 11.22
> FreeBSD 4.7
> 
> Although this flag combination is left unspecified by SUSv3, I don't
> know of an implementation that DOESN'T truncate in these circumstances.

Yes, when we talked about it I checked a few Linux versions, Solaris 5.7, 5.8,
and Irix 6.5 and they all truncate.

So, the standard says "unspecified" but the industry consensus is clearly
"truncate", never mind the O_RDONLY.

Probably the "unspecified" is there for a good reason, so people should be
able to find systems that do not truncate, but there is no reason at all
for Linux to change behaviour.


  reply	other threads:[~2003-07-17 10:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-17  7:54 Bug in open() function (?) Michael Kerrisk
2003-07-17 10:54 ` Andries Brouwer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-07-12  1:17 [PATCH] [2.5] adding ppp xon/xoff support Samuel Thibault
2003-07-12  1:30 ` Paul Mackerras
2003-07-12  2:42   ` Samuel Thibault
2003-07-12  3:09     ` Bug in open() function (?) J.C. Wren
2003-07-12  3:38       ` Andrew Morton
2003-07-12  5:11         ` Valdis.Kletnieks
2003-07-12  5:23           ` Andrew Morton
2003-07-12  6:14             ` Valdis.Kletnieks
2003-07-12  9:37               ` Andries Brouwer
2003-07-12 12:04                 ` jw schultz
2003-07-12  5:39           ` J.C. Wren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030717125407.C2302@pclin040.win.tue.nl \
    --to=aebr@win.tue.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk-lists@jambit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).