Article View: comp.std.unix
Article #1053Re: open file range
From: Simon Brown
Date: Thu, 18 Jun 1987 16:12
Date: Thu, 18 Jun 1987 16:12
32 lines
2080 bytes
2080 bytes
From: simon@its63b.ed.ac.uk (Simon Brown)
In article <8271@ut-sally.UUCP> Doug Gwyn (VLD/VMB) <gwyn@BRL.ARPA> writes:
>From: Doug Gwyn (VLD/VMB) <gwyn@BRL.ARPA>
>
>I submitted a proposal to X3J11 that fflush((FILE*)NULL) would
>flush ALL output buffers, since there is no other good way to
>accomplish that. It seems that close(-1) might be a similar
>solution for POSIX. (Since nobody is supposed to be doing this
>currently, it is available for assigning new semantics to.)
>
Arghhh, no! Don't do that! Ok, it might seem a truly wonderful idea, but
it would mean that things like
fd = open(some-random-filename,something);
do-something-bizarre-with-fd;
close(fd);
will do a "close(-1)" if the open happened to fail for some reason or other,
which is harmless at the moment (just returns -1, errno=EBADF), but would be
a bit tragic with this new semantics!
Yes, I know this isn't a problem if everyone always checks the return-value
from open(), creat(), etc..., but lots of programs aren't that pessimistic!
--
----------------------------------
| Simon Brown | UUCP: seismo!mcvax!ukc!{its63b,cstvax}!simon
| Department of Computer Science | JANET: simon@uk.ac.ed.{its63b,cstvax}
| University of Edinburgh, | ARPA: simon%{its63b,cstvax}.ed.ac.uk ...
| Scotland, UK. | @cs.ucl.ac.uk
---------------------------------- "Life's like that, you know"
Volume-Number: Volume 11, Number 74
Technical Details
Message-ID:
<8301@ut-sally.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!std-unixReferences:
<8271@ut-sally.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!std-unix From: simon@its63b.ed.ac.uk (Simon Brown) Newsgroups: comp.std.unix Subject: Re: open file range Message-ID: <8301@ut-sally.UUCP> Date: Thu, 18-Jun-87 12:12:39 EDT Article-I.D.: ut-sally.8301 Posted: Thu Jun 18 12:12:39 1987 Date-Received: Mon, 22-Jun-87 02:12:25 EDT References: <8271@ut-sally.UUCP> Sender: std-unix@ut-sally.UUCP Reply-To: simon@its63b.ed.ac.uk (Simon Brown) Organization: Computer Science Department, Edinburgh University Lines: 32 Approved: jsq@sally.utexas.edu (Moderator, John Quarterman)