]> git.wh0rd.org - patches.git/blame - uclibc-tempname3.patch
more random patches. who knows.
[patches.git] / uclibc-tempname3.patch
CommitLineData
5e993f12 1--- /home/nickolai/build/uClibc-0.9.29_rc1/libc/misc/internals/tempname.c 2006-01-27 13:26:40.000000000 -0800
2+++ tempname.c 2007-05-02 13:25:05.000000000 -0700
3@@ -192,7 +192,7 @@
4 int attribute_hidden __gen_tempname (char *tmpl, int kind)
5 {
6 char *XXXXXX;
7- unsigned int i;
8+ unsigned int i, count;
9 int fd, save_errno = errno;
10 unsigned char randomness[6];
11 size_t len;
12@@ -206,16 +206,15 @@
13 return -1;
14 }
15
16- /* Get some random data. */
17- if (fillrand(randomness, sizeof(randomness)) != sizeof(randomness)) {
18- /* if random device nodes failed us, lets use the braindamaged ver */
19- brain_damaged_fillrand(randomness, sizeof(randomness));
20- }
21-
22- for (i = 0; i < sizeof(randomness); ++i)
23- XXXXXX[i] = letters[(randomness[i]) % NUM_LETTERS];
24+ for (count = 0; count < TMP_MAX; ++count) {
25+ /* Get some random data. */
26+ if (fillrand(randomness, sizeof(randomness)) != sizeof(randomness)) {
27+ /* if random device nodes failed us, lets use the braindamaged ver */
28+ brain_damaged_fillrand(randomness, sizeof(randomness));
29+ }
30
31- for (i = 0; i < TMP_MAX; ++i) {
32+ for (i = 0; i < sizeof(randomness); ++i)
33+ XXXXXX[i] = letters[(randomness[i]) % NUM_LETTERS];
34
35 switch(kind) {
36 case __GT_NOCREATE: