From b61af6fc2ea0f305c60befc7f50b9d6aa4f0ea38 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 15 Dec 1998 00:02:24 +0000 Subject: [PATCH] Update. 1998-12-15 Andreas Jaeger * stdio-common/tst-tmpnam.c (main): Use void as parameter to avoid warnings about unused args. Fix comment. 1998-12-15 Andreas Jaeger * sysdeps/posix/tempname.c (__path_search): Correct last patch. --- ChangeLog | 9 +++++++++ stdio-common/tst-tmpnam.c | 4 ++-- sysdeps/posix/tempname.c | 17 ++++++++++------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16eed19..7057805 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +1998-12-15 Andreas Jaeger + + * stdio-common/tst-tmpnam.c (main): Use void as parameter to avoid + warnings about unused args. Fix comment. + +1998-12-15 Andreas Jaeger + + * sysdeps/posix/tempname.c (__path_search): Correct last patch. + 1998-12-14 Ulrich Drepper * 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 2a23a14..3253575 100644 --- a/stdio-common/tst-tmpnam.c +++ b/stdio-common/tst-tmpnam.c @@ -21,7 +21,7 @@ #include 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 1a11375..5b6134c 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); -- 2.7.4