Date: Sat, 18 Aug 2001 10:35:36 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: sandmann AT clio DOT rice DOT edu Message-Id: <2427-Sat18Aug2001103535+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp-workers AT delorie DOT com, wojciech DOT galazka AT polkomtel DOT com DOT pl In-reply-to: <10108180453.AA14191@clio.rice.edu> (sandmann@clio.rice.edu) Subject: Re: Win2K : what about _creat* ? References: <10108180453 DOT AA14191 AT clio DOT rice DOT edu> 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 Precedence: bulk > From: sandmann AT clio DOT rice DOT edu (Charles Sandmann) > Date: Fri, 17 Aug 2001 23:53:28 -0500 (CDT) > > > > > I suggest the other way around: open first, then close the LFN > > > > handle. This way, you minimize the risk of something removing the > > > > file in between. (You might need to fsync the handle before the call > > > > to _open, though.) > > At this point the file should be empty either way, so why would fsync > be needed? Without fsync, the file might not be empty on disk, or might not even exist, if you created it. I'm not saying you _must_ use fsync, just that you _might_ need it. > I think the odds of the file disappearing in the millisecond > between close and reopen to be pretty small (especially since this > insanity only is foisted upon Win2K/XP). Windows is a multi-processing system, so that millisecond could become much longer, if the CPU is preempted between close and reopen. _creat_new is used by functions which create temporary files, where this contention might be important and should be kept to a minimum.