summaryrefslogtreecommitdiff
path: root/src/stdio/tmpnam.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-29 09:00:22 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-29 09:00:22 -0400
commit8250742b90b8b54e642fa9201bf0cf8b7c27bbb8 (patch)
treea12ed40d599ed320b5a9c669bddafe3905e48edd /src/stdio/tmpnam.c
parenta88edbec15abe3c8e08d5065d8bea399898e757c (diff)
downloadmusl-8250742b90b8b54e642fa9201bf0cf8b7c27bbb8.tar.gz
fix tempnam name generation, and a small bug in tmpnam on retry limit
Diffstat (limited to 'src/stdio/tmpnam.c')
-rw-r--r--src/stdio/tmpnam.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/tmpnam.c b/src/stdio/tmpnam.c
index 6099b74b..010cf039 100644
--- a/src/stdio/tmpnam.c
+++ b/src/stdio/tmpnam.c
@@ -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;
}