From: kunst AT prl DOT philips DOT nl Subject: libsrc\c\gen\mktemp.c patch (solves tmpnam bug) To: djgpp AT sun DOT soe DOT clarkson DOT edu (DJGPP users list) Date: Thu, 1 Sep 1994 14:30:08 +0100 (METDST) Hello DJ, I've found the 'tmpnam' bug in dj112m1. My earlier report that this was located in stat() was wrong. The test program below (+output) shows that findfirst() when invoked with a non-existent filename sets errno to 18 (ENMFILE), (No more files) and not to 2 (ENOENT) (No such file or directory). (Tested on a MS-DOS 6.2 system.) Adding the patch below (to libsrc\c\gen\mktemp.c) solves the problem. Regards, Pieter Kunst (kunst AT prl DOT philips DOT nl) =============================================================================== *** mktemp.old Sun Aug 28 02:12:58 1994 --- mktemp.c Thu Sep 1 18:17:18 1994 *************** *** 84,90 **** return(0); } else if (stat(path, &sbuf)) ! return(errno == ENOENT ? 1 : 0); /* tricky little algorithm for backward compatibility */ for (trv = start;;) { --- 84,90 ---- return(0); } else if (stat(path, &sbuf)) ! return((errno == ENOENT) || (errno == ENMFILE) ? 1 : 0); /* tricky little algorithm for backward compatibility */ for (trv = start;;) { =============================================================================== #include