delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/05/26/14:51:04

From: pavenis AT lanet DOT lv
To: djgpp-workers AT delorie DOT com, "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Date: Fri, 26 May 2000 20:50:43 +0200
MIME-Version: 1.0
Subject: Re: gcc djgpp stopped working
Message-ID: <392EE3A3.32215.DE4EE@localhost>
In-reply-to: <392EDC2D.15119.171CE80@localhost>
References: <200005261637 DOT TAA01181 AT mailgw1 DOT netvision DOT net DOT il>
X-mailer: Pegasus Mail for Win32 (v3.12c)
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

On 26 May 2000, at 20:18, pavenis AT lanet DOT lv wrote:

> 
> Looked sources in gcc2952s.zip (latest update not ones uploaded to 
> ftp.delorie.com, but I haven't changed any related thing for along time)
> 
> There is possibility of some problems:
> 
> Let assume gcc tries to create file in TMPDIR=c:/tmp and directory 
> with the same name already exist there. Then it gets EPERM (If there is 
> busy file I got EEXIST at least in DOS session under Win98 SE). That 
> is rather unlikely as biostime() is used to generate first file name (and 
> it's later incremented). 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)
> 
> 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.
> 
> Anyway I think that running into this problem is very unlikely

Here is simple patch for mktemps.c (it's rather unlikely to get problems 
here but anyway ...)

Andris

*** src/libc/compat/stdio/mkstemp.c~1	Sun Dec 13 08:10:58 1998
--- src/libc/compat/stdio/mkstemp.c	Fri May 26 20:31:52 2000
***************
*** 18,24 ****
      errno = 0;
    } while (mktemp (tmp_name) != NULL
  	   && (fd = _creatnew(tmp_name, 0, SH_DENYRW)) == -1
! 	   && errno == EEXIST);
  
    if (fd == -1)
      errno = ENOENT;
--- 18,25 ----
      errno = 0;
    } while (mktemp (tmp_name) != NULL
  	   && (fd = _creatnew(tmp_name, 0, SH_DENYRW)) == -1
! 	   && (errno == EEXIST || 
!                 (errno == EPERM && !access(tmp_name))));
  
    if (fd == -1)
      errno = ENOENT;

- Raw text -


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