From: simonmar Date: Thu, 11 May 2000 13:30:11 +0000 (+0000) Subject: [project @ 2000-05-11 13:30:11 by simonmar] X-Git-Tag: Approximately_9120_patches~4512 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=ef62a97ed0cdc33f4f8892561fb37682e8769044;p=ghc-hetmet.git [project @ 2000-05-11 13:30:11 by simonmar] Try to avoid clashes with files already in $TMPDIR. --- diff --git a/ghc/driver/ghc.lprl b/ghc/driver/ghc.lprl index ea1a7e3..e68881d 100644 --- a/ghc/driver/ghc.lprl +++ b/ghc/driver/ghc.lprl @@ -158,7 +158,14 @@ $SIG{'QUIT'} = 'quit_upon_signal'; : "$TopPwd/${CURRENT_DIR}" ); if ( $ENV{'TMPDIR'} ) { # where to make tmp file names - $Tmp_prefix = ($ENV{'TMPDIR'} . "/ghc$$"); + # Try to find a $Tmp_prefix which isn't being used... + $tmp = $$; + do { + $Tmp_prefix = ($ENV{'TMPDIR'} . "/ghc$tmp"); + $tmp++; + } while ( -e "$Tmp_prefix.hc" || + -e "$Tmp_Prefix.s" || + -e "$Tmp_Prefix.hi" ); } else { print STDERR "TMPDIR has not been set to anything useful!\n" if (${TMPDIR} eq ''); $Tmp_prefix ="${TMPDIR}/ghc$$"; # TMPDIR set via Makefile when booting..