Fallback onto TEMP if TMPDIR undefined (#441)
This commit is contained in:
parent
507b4e52be
commit
7e53747509
10
misc.c
10
misc.c
|
@ -1739,7 +1739,15 @@ mktemp_proto(char *s, size_t len)
|
|||
const char *tmpdir;
|
||||
int r;
|
||||
|
||||
if ((tmpdir = getenv("TMPDIR")) != NULL) {
|
||||
tmpdir = getenv("TMPDIR");
|
||||
|
||||
#ifdef WINDOWS
|
||||
if (tmpdir == NULL) {
|
||||
tmpdir = getenv("TEMP");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tmpdir != NULL) {
|
||||
r = snprintf(s, len, "%s/ssh-XXXXXXXXXXXX", tmpdir);
|
||||
if (r > 0 && (size_t)r < len)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue