www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/24/13:18:26

Xref: news2.mv.net comp.os.msdos.djgpp:4225
From: olly AT mantis DOT co DOT uk (Olly Betts)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: EACCES on read
Date: 24 May 1996 11:55:31 +0100
Organization: techn-ol-ogy
Lines: 22
Message-ID: <19960524104424.olly@mantis.co.uk>
References: <199605232225 DOT SAA08438 AT delorie DOT com>
NNTP-Posting-Host: sunforest.mantis.co.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <199605232225 DOT SAA08438 AT delorie DOT com>,
DJ Delorie <dj AT delorie DOT com> wrote:
>> If there is a pre-existing file, which you then try to overwrite
>> using `creat', the first read from the file will return a -1 with
>> errno==EACCESS, instead of a zero-length read.
>
>If you open the file with creat(), you shouldn't be able to read from
>it at all, because it's open only for writing.  I think EACCES is the
>right response here.

'man read' on our Solaris 2.3 box says (my emphasis):

     EBADF          fildes is not a valid  file  descriptor  open
                    for reading.                             ^^^^
		    ^^^^^^^^^^^^

And a quick test program bears this out -- read() returns -1 and errno is
set to EBADF.  The Microsoft Visual C/C++ help files agree with this.

Olly
-- 
cool wet grass  cool wet grass  cool wet grass  cool wet grass  cool wet grass

- Raw text -


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