svn commit: trunk/uClibc/libc/misc/internals

vapier at uclibc.org vapier at uclibc.org
Sun May 6 09:18:40 UTC 2007


Author: vapier
Date: 2007-05-06 02:18:39 -0700 (Sun, 06 May 2007)
New Revision: 18563

Log:
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


Modified:
   trunk/uClibc/libc/misc/internals/tempname.c


Changeset:
Modified: trunk/uClibc/libc/misc/internals/tempname.c
===================================================================
--- trunk/uClibc/libc/misc/internals/tempname.c	2007-05-06 01:37:21 UTC (rev 18562)
+++ trunk/uClibc/libc/misc/internals/tempname.c	2007-05-06 09:18:39 UTC (rev 18563)
@@ -206,18 +206,17 @@
 	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;




More information about the uClibc-cvs mailing list