|
|
b95404 |
commit e1df30fbc2e2167a982c0e77a7ebee28f4dd0800
|
|
|
b95404 |
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
|
b95404 |
Date: Thu Jul 25 11:22:17 2019 -0300
|
|
|
b95404 |
|
|
|
b95404 |
Get new entropy on each attempt __gen_tempname (BZ #15813)
|
|
|
b95404 |
|
|
|
b95404 |
This is missing bit for fully fix BZ#15813 (the other two were fixed
|
|
|
b95404 |
by 359653aaacad463).
|
|
|
b95404 |
|
|
|
b95404 |
Checked on x86_64-linux-gnu.
|
|
|
b95404 |
|
|
|
b95404 |
[BZ #15813]
|
|
|
b95404 |
sysdeps/posix/tempname.c (__gen_tempname): get entrypy on each
|
|
|
b95404 |
attempt.
|
|
|
b95404 |
|
|
|
b95404 |
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
|
|
|
b95404 |
index 3d26f378021680ae..61d7a9f36d37abae 100644
|
|
|
b95404 |
--- a/sysdeps/posix/tempname.c
|
|
|
b95404 |
+++ b/sysdeps/posix/tempname.c
|
|
|
b95404 |
@@ -186,7 +186,6 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
|
|
b95404 |
{
|
|
|
b95404 |
int len;
|
|
|
b95404 |
char *XXXXXX;
|
|
|
b95404 |
- uint64_t value;
|
|
|
b95404 |
unsigned int count;
|
|
|
b95404 |
int fd = -1;
|
|
|
b95404 |
int save_errno = errno;
|
|
|
b95404 |
@@ -218,13 +217,13 @@ __gen_tempname (char *tmpl, int suffixlen, int flags, int kind)
|
|
|
b95404 |
/* This is where the Xs start. */
|
|
|
b95404 |
XXXXXX = &tmpl[len - 6 - suffixlen];
|
|
|
b95404 |
|
|
|
b95404 |
- /* Get some more or less random data. */
|
|
|
b95404 |
- RANDOM_BITS (value);
|
|
|
b95404 |
- value ^= (uint64_t)__getpid () << 32;
|
|
|
b95404 |
-
|
|
|
b95404 |
- for (count = 0; count < attempts; value += 7777, ++count)
|
|
|
b95404 |
+ uint64_t pid = (uint64_t) __getpid () << 32;
|
|
|
b95404 |
+ for (count = 0; count < attempts; ++count)
|
|
|
b95404 |
{
|
|
|
b95404 |
- uint64_t v = value;
|
|
|
b95404 |
+ uint64_t v;
|
|
|
b95404 |
+ /* Get some more or less random data. */
|
|
|
b95404 |
+ RANDOM_BITS (v);
|
|
|
b95404 |
+ v ^= pid;
|
|
|
b95404 |
|
|
|
b95404 |
/* Fill in the random bits. */
|
|
|
b95404 |
XXXXXX[0] = letters[v % 62];
|