From: eliz AT is DOT elta DOT co DOT il Message-Id: <200005270638.JAA08011@mailgw1.netvision.net.il> Date: Sat, 27 May 2000 09:37:26 +0200 To: pavenis AT lanet DOT lv Cc: djgpp-workers AT delorie DOT com X-Mailer: WinNT's Blat ver 1.8.5b http://www.interlog.com/~tcharron In-reply-to: <392EDC2D.15119.171CE80@localhost> (pavenis@lanet.lv) Subject: Re: gcc djgpp stopped working References: <392EBD54 DOT 13380 DOT F946F1 AT localhost> (pavenis AT lanet DOT lv) <392EDC2D DOT 15119 DOT 171CE80 AT localhost> 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 --text follows this line-- > From: pavenis AT lanet DOT lv > Date: Fri, 26 May 2000 20:18:53 +0200 > > Let assume gcc tries to create file in TMPDIR=c:/tmp and directory > with the same name already exist there. Then it gets EPERM Sorry, I don't understand: EPERM should never be returned in DJGPP, except for some very obscured network-related problems (see doserr2e.c in the library). Perhaps you meant EACCES? > That > is rather unlikely as biostime() is used to generate first file name (and > it's later incremented). Where do you see the call to biostime? Is it something that GCC sources do? I don't see biostime in mkstemp. > In this case (BUG) it's assumed that directory is > bad and it quits the loop. Function mkstemp() in libc also has this > problem (if it gets EPERM it quits the loop) But if the file or directory by that name exists, mktemp will see it, because it calls __file_exists, and so it will never return a name of an existing file. What you describe can only happen in a race condition, when a directory is created *after* mktemp returned a name of a file that didn't exist a moment before. > Perhaps mkstemp should use stat() if it gets EPERM to verify whether > file (or directory) exists and and only give up if it's doen't exist. stat is too expensive. We could add EACCES to EEXIST, or we could explicitly check with _chmod to cover the directory case. In any case, I think GCC should not abort, but print an error message in these cases.