summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-05-06 09:18:39 +0000
committerMike Frysinger <vapier@gentoo.org>2007-05-06 09:18:39 +0000
commit420745afd47f7291f5f3f28d0ff68d58245d1105 (patch)
tree0123c072a857fdc814f0b24d8219d3b2a8ad3c76 /libc
parent4655544cb6de06a4a83c09c4d79dfb54fbde8f00 (diff)
Nickolai Zeldovich writes: if the temp name already exists, then the retry code does not create a new temp name as the code to do so is outside of the retry loop
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/internals/tempname.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c
index 26918dc16..dc125020b 100644
--- a/libc/misc/internals/tempname.c
+++ b/libc/misc/internals/tempname.c
@@ -206,18 +206,17 @@ int attribute_hidden __gen_tempname (char *tmpl, int kind)
return -1;
}
- /* Get some random data. */
- if (fillrand(randomness, sizeof(randomness)) != sizeof(randomness)) {
- /* if random device nodes failed us, lets use the braindamaged ver */
- brain_damaged_fillrand(randomness, sizeof(randomness));
- }
-
- for (i = 0; i < sizeof(randomness); ++i)
- XXXXXX[i] = letters[(randomness[i]) % NUM_LETTERS];
-
for (i = 0; i < TMP_MAX; ++i) {
+ int j;
+ /* Get some random data. */
+ if (fillrand(randomness, sizeof(randomness)) != sizeof(randomness)) {
+ /* if random device nodes failed us, lets use the braindamaged ver */
+ brain_damaged_fillrand(randomness, sizeof(randomness));
+ }
+ for (j = 0; j < sizeof(randomness); ++j)
+ XXXXXX[j] = letters[randomness[j] % NUM_LETTERS];
- switch(kind) {
+ switch (kind) {
case __GT_NOCREATE:
{
struct stat st;