Mail Archives: djgpp-workers/2000/05/26/14:51:04
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 -