diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-12-14 15:23:56 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-12-14 15:23:56 +0000 |
commit | 60876a75445b1b65e4a0ec54e18205a79f79466b (patch) | |
tree | f1ed7e59c543e092bbd492af3654abfad53a4344 /sysdeps | |
parent | 59036602bf40d3b35884280881be4edfb1378430 (diff) | |
download | glibc-60876a75445b1b65e4a0ec54e18205a79f79466b.zip glibc-60876a75445b1b65e4a0ec54e18205a79f79466b.tar.gz glibc-60876a75445b1b65e4a0ec54e18205a79f79466b.tar.bz2 |
Update.
* include/stdio.h: Add new parameter to __path_search.
* libio/oldtmpfile.c: Add 0 as new parameter to __path_search.
* stdio-common/tmpfile.c: Likewise.
* stdio-common/tmpfile64.c: Likewise.
* stdio-common/tmpnam.c: Likewise.
* stdio-common/tmpnam_r.c: Likewise.
* stdio-common/tempnam.c: Add 1 as new parameter to __path_search.
* sysdeps/posix/tempname.c: Add new parameter. If value is nonzero
consider TMPDIR environment variable and dir parameter. Otherwise not.
* stdio-common/Makefile (tests): Add tst-tmpnam.
* stdio-common/tst-tmpnam.c: New file.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/posix/tempname.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c index 97a01d2..1a11375 100644 --- a/sysdeps/posix/tempname.c +++ b/sysdeps/posix/tempname.c @@ -43,7 +43,8 @@ direxists (const char *dir) doesn't exist, none of the searched dirs exists, or there's not enough space in TMPL. */ int -__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx) +__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, + int try_tmpdir) { const char *d; size_t dlen, plen; @@ -60,14 +61,17 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx) plen = 5; } - d = __secure_getenv ("TMPDIR"); - if (d != NULL && direxists (d)) - dir = d; - else if (dir != NULL && direxists (dir)) - /* nothing */ ; - else if (direxists (P_tmpdir)) + if (try_tmpdir) + { + d = __secure_getenv ("TMPDIR"); + if (d != NULL && direxists (d)) + dir = d; + else if (dir != NULL && direxists (dir)) + /* nothing */ ; + } + if (direxists (P_tmpdir)) dir = P_tmpdir; - else if (direxists ("/tmp")) + else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) dir = "/tmp"; else { |