about summary refs log tree commit diff
path: root/sysdeps/posix/tempname.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-12-15 00:02:24 +0000
committerUlrich Drepper <drepper@redhat.com>1998-12-15 00:02:24 +0000
commitb61af6fc2ea0f305c60befc7f50b9d6aa4f0ea38 (patch)
treef0ed6cd926d61faeb19f7cf6eb2d2c78bbff0255 /sysdeps/posix/tempname.c
parent181a8546c8139675180f32ab87d239517263ad76 (diff)
downloadglibc-b61af6fc2ea0f305c60befc7f50b9d6aa4f0ea38.tar.gz
glibc-b61af6fc2ea0f305c60befc7f50b9d6aa4f0ea38.tar.xz
glibc-b61af6fc2ea0f305c60befc7f50b9d6aa4f0ea38.zip
Update.
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. 
 
Diffstat (limited to 'sysdeps/posix/tempname.c')
-rw-r--r--sysdeps/posix/tempname.c17
1 files changed, 10 insertions, 7 deletions
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);