1998-04-13  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/posix/mktemp.c: Increment `value' in a way which touches
	all needed 36 bits.
	* sysdeps/posix/mkstemp.c: Likewise.
This commit is contained in:
Ulrich Drepper 1998-04-13 22:59:33 +00:00
parent 2aea1d796e
commit bbdc8261f8
3 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,9 @@
1998-04-13 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/posix/mktemp.c: Increment `value' in a way which touches
all needed 36 bits.
* sysdeps/posix/mkstemp.c: Likewise.
1998-04-13 17:40 Ulrich Drepper <drepper@cygnus.com>
* iconvdata/8bit-gap.c: Simplify step data handling.

View File

@ -53,7 +53,7 @@ mkstemp (template)
/* Get some more or less random data. */
__gettimeofday (&tv, NULL);
value += tv.tv_usec | getpid ();
value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
for (count = 0; count < TMP_MAX; ++count)
{

View File

@ -35,7 +35,7 @@ mktemp (template)
{
static const char letters[]
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static uint32_t value;
static uint64_t value;
struct timeval tv;
char *XXXXXX;
size_t len;
@ -53,12 +53,12 @@ mktemp (template)
/* Get some more or less random data. */
__gettimeofday (&tv, NULL);
value += tv.tv_usec | getpid ();
value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
for (count = 0; count < TMP_MAX; ++count)
{
struct stat ignored;
uint32_t v = value;
uint64_t v = value;
/* Fill in the random bits. */
XXXXXX[0] = letters[v % 62];