Sync libiberty from GCC, replaying updates to configure scripts
[deliverable/binutils-gdb.git] / libiberty / make-temp-file.c
index 13e192565340266e80d40ff2bc56a8d6179b6325..244cc23c5090e1c0d227820dc703adbc8022f8d5 100644 (file)
@@ -1,5 +1,6 @@
 /* Utility to pick a temporary filename prefix.
-   Copyright (C) 1996, 1997, 1998, 2001, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2001, 2009, 2010
+   Free Software Foundation, Inc.
 
 This file is part of the libiberty library.
 Libiberty is free software; you can redistribute it and/or
@@ -92,7 +93,7 @@ static char *memoized_tmpdir;
 
 /*
 
-@deftypefn Replacement char* choose_tmpdir ()
+@deftypefn Replacement const char* choose_tmpdir ()
 
 Returns a pointer to a directory path suitable for creating temporary
 files in.
@@ -101,7 +102,7 @@ files in.
 
 */
 
-char *
+const char *
 choose_tmpdir (void)
 {
   if (!memoized_tmpdir)
@@ -121,7 +122,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.  */
This page took 0.036781 seconds and 4 git commands to generate.