delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/28/06:34:15

Date: Tue, 28 Apr 1998 13:33:41 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Andreas Kochenburger <kochenbu AT no DOT spam DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: Bug in djgpp 2.8.0b with open()?
In-Reply-To: <35445ba9.13407571@news>
Message-ID: <Pine.SUN.3.91.980428132811.27094B-100000@is>
MIME-Version: 1.0

On Mon, 27 Apr 1998, Andreas Kochenburger wrote:

> However S_IREAD|S_IWRITE was set for that purpose, which is generally
> used for the default file access modes, at least as far as I know, but
> I am not a C specialist. So I tend to the notion that djgpp has to be
> blamed here, and not the other compilers.

S_IREAD and S_IWRITE don't have anything to do with this problem.  The
S_Ixxx bits determine the access rights to the file which is created (if
it doesn't exist already), but they don't say how the program will access
the file.  A file can be created to be writable, but a program still can
access it only for reading.  Your original program requested a read-only
access to a file that can be written to, so it failed because truncating a
file needs to write to it. 

So there's nothing wrong in DJGPP here, you have just used the function 
not the way you wanted.
 
> I don't know if there is a comment on that in the ANSI standard.

ANSI standard doesn't say anything about the `open' function because 
`open' is non-ANSI.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019