From patchwork Mon Jul 12 16:04:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: - fix handling of temporary directories on Windows From: Pascal Obry X-Patchwork-Id: 58632 Message-Id: <4C3B3D11.7030501@adacore.com> To: gcc-patches Date: Mon, 12 Jul 2010 18:04:33 +0200 ChangeLog: 2010-07-09 Pascal Obry * libibery/make-temp-file.c (choose_tmpdir): When TMPDIR, TMP and TEMP are not set, P_tmpdir is used on Windows. This is defined as "\" in current MingW header. Append a dot to ensure that when concatenating with \dir we do not end-up with an UNC path. Fix a crash on the compiler. Patch as attachment. diff libiberty/make-temp-file.c libiberty/make-temp-file.c index 13e1925..f754b45 100644 --- libiberty/make-temp-file.c +++ libiberty/make-temp-file.c @@ -121,7 +121,12 @@ choose_tmpdir (void) #endif #ifdef P_tmpdir - base = try_dir (P_tmpdir, base); + /* We really want a directory name here as if concatenated with say \dir + we do not end-up with a double \\ which defines an UNC path. */ + if (strcmp (P_tmpdir, "\\") == 0) + base = try_dir ("\\.", base); + else + base = try_dir (P_tmpdir, base); #endif /* Try /var/tmp, /usr/tmp, then /tmp. */