delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/20/07:09:00

X-Sybari-Trust: e89c7fe3 9ffcebbb cd1bde24 00000138
From: Martin Stromberg <eplmst AT epl DOT ericsson DOT se>
Message-Id: <200301201208.NAA02824@lws256.lu.erisoft.se>
Subject: Re: _createnew
To: djgpp-workers AT delorie DOT com
Date: Mon, 20 Jan 2003 13:08:54 +0100 (MET)
In-Reply-To: <3E2BD16A.93D63093@phekda.freeserve.co.uk> from "Richard Dawe" at Jan 20, 2003 10:37:30 AM
X-Mailer: ELM [version 2.5 PL3]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> > > I'm not sure I like that. Wouldn't it be better (more consistent) to rely
> > > on DOS to maintain this information?
> > 
> > Yes, if possible. But remember the potential race condition.
> 
> Which potential race condition? Do you mean the one I describe in this mail
> (the last one listed for _creatnew on the 2.04 status page):
> 
> http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp-workers/2002/04/05/08:00:44

Yes.

> Or is there another one?

Not that I know about.

Buuuuut, consider that some application can use _creatnew() for
creating a lock file. In that case O_RDONLY might make sense(1). With
that workaround some other process might be able to open the file in
between _creatnew()'s closing and reopening.

Anyway it's DOZE we're talking about so that scenario doesn't make
much sense, but I've heard that our libc is used in other places as
well.

(1) Personally I think if you try to create a file with O_RDONLY, you
don't know what you're doing. How about this for a different
implementation: if you call _creatnew() without some write permission,
fail the call.


Right,

						MartinS

- Raw text -


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