fix tempnam name generation, and a small bug in tmpnam on retry limit
This commit is contained in:
parent
a88edbec15
commit
8250742b90
2 changed files with 20 additions and 21 deletions
|
|
@ -26,5 +26,5 @@ char *tmpnam(char *s)
|
|||
n = ts.tv_nsec ^ (unsigned)&s ^ (unsigned)s;
|
||||
snprintf(s, L_tmpnam, "/tmp/t%x-%x", a_fetch_add(&index, 1), n);
|
||||
} while (!__syscall(SYS_access, s, F_OK) && try++<MAXTRIES);
|
||||
return try==MAXTRIES ? 0 : s;
|
||||
return try>=MAXTRIES ? 0 : s;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue