Skip to content

Commit

Permalink
Improve temporary file name guess.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Jul 15, 2002
1 parent 4123907 commit 4eea872
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion driver/main.c
Expand Up @@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: main.c,v 1.43 2002/07/14 23:32:31 steve Exp $"
#ident "$Id: main.c,v 1.44 2002/07/15 00:33:50 steve Exp $"

# include "config.h"

Expand Down Expand Up @@ -44,6 +44,7 @@ const char HELP[] =

#ifdef __MINGW32__
#include <windows.h>
#include <libiberty.h>
#endif

#if HAVE_GETOPT_H
Expand Down Expand Up @@ -134,9 +135,18 @@ static const char*my_tempfile(const char*str, FILE**fout)
tmpdir = getenv("TMPDIR");
if (tmpdir == 0)
tmpdir = getenv("TEMP");
#ifdef __MINGW32__
if (tmpdir == 0)
tmpdir = "C:\TEMP";
#else
if (tmpdir == 0)
tmpdir = "/tmp";
#endif

assert(tmpdir);
assert((strlen(tmpdir) + strlen(str)) < sizeof pathbuf - 10);

srand(getpid());
retry = 100;
file = NULL;
while ((retry > 0) && (file == NULL)) {
Expand Down Expand Up @@ -746,6 +756,9 @@ int main(int argc, char **argv)

/*
* $Log: main.c,v $
* Revision 1.44 2002/07/15 00:33:50 steve
* Improve temporary file name guess.
*
* Revision 1.43 2002/07/14 23:32:31 steve
* No longer need the .exe on generated files.
*
Expand Down

0 comments on commit 4eea872

Please sign in to comment.