summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--stdio-common/tst-tmpnam.c4
-rw-r--r--sysdeps/posix/tempname.c17
3 files changed, 21 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 16eed1917b..7057805247 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+1998-12-15  Andreas Jaeger  <aj@arthur.rhein-neckar.de> 
+ 
+	* stdio-common/tst-tmpnam.c (main): Use void as parameter to avoid  
+	warnings about unused args.  Fix comment. 
+ 
+1998-12-15  Andreas Jaeger  <aj@arthur.rhein-neckar.de> 
+ 
+	* sysdeps/posix/tempname.c (__path_search): Correct last patch. 
+ 
 1998-12-14  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sunrpc/rpc/xdr.h (IXDR_GET_INT32): Case pointer before reading from
diff --git a/stdio-common/tst-tmpnam.c b/stdio-common/tst-tmpnam.c
index 2a23a14149..3253575ccd 100644
--- a/stdio-common/tst-tmpnam.c
+++ b/stdio-common/tst-tmpnam.c
@@ -21,7 +21,7 @@
 #include <string.h>
 
 int
-main (int argc, char *argv[])
+main (void)
 {
   const char *name;
   int retval = 0;
@@ -33,7 +33,7 @@ main (int argc, char *argv[])
 
   printf ("name = %s\n", name);
 
-  /* Make sure the name is based on the value in TMPDIR.  */
+  /* Make sure the name is not based on the value in TMPDIR.  */
   if (strncmp (name, "/usr", 4) == 0)
     {
       puts ("error: `tmpnam' used TMPDIR value");
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index 1a113757aa..5b6134cb24 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -69,14 +69,17 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
       else if (dir != NULL && direxists (dir))
 	/* nothing */ ;
     }
-  if (direxists (P_tmpdir))
-    dir = P_tmpdir;
-  else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
-    dir = "/tmp";
-  else
+  if (dir != NULL)
     {
-      __set_errno (ENOENT);
-      return -1;
+      if (direxists (P_tmpdir))
+	dir = P_tmpdir;
+      else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp"))
+	dir = "/tmp";
+      else
+	{
+	  __set_errno (ENOENT);
+	  return -1;
+	}
     }
 
   dlen = strlen (dir);