[lkml]   [2003]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: incompatible open modes
Hi Andries,

If that's what's been decided... I presume for backwards compatability,
but it does seem rather odd though. After all, it seems like O_RDONLY
is supposed to safeguard someone from accidently overwriting a file.
Otherwise why not automatically open everything read/write? Going down
the same path, what's next: automatically write enabling a file which
has been openend for O_RDONLY the next time someone performs a write
operation on it? ;-)

Take care,

-----Original Message-----
From: Andries Brouwer []
Sent: Thursday, July 31, 2003 1:36 PM
To: Zack Brown
Cc: Ata, John; Linux Kernel Mailing List
Subject: Re: incompatible open modes

> On Thu, Jul 31, 2003 at 12:09:14PM -0400, Ata, John wrote:

> > the manpage on "open" states that if a file is opened
> > the O_TRUNC is either ignored or an error is returned. The 2.4
> > appears to cheerfully truncate the file on open. I wondered
> > behavior is actually intended.
> >
> > If the file already exists and is a regular file and the
> > mode allows writing (i.e., is O_RDWR or O_WRONLY) it will
> > truncated to length 0.
> > Otherwise the effect of O_TRUNC is unspecified.
> > (On many Linux versions it will be ignored; on other versions
> > it will return an error.)

This was just recently discussed, and it became clear that the
remark only led to confusion. It has been deleted. Instead

The (undefined) effect of O_RDONLY | O_TRUNC various among
implementations. On many systems the file is actually

has been added.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:47    [W:0.044 / U:4.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site