summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-13 22:59:33 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-13 22:59:33 +0000
commitbbdc8261f84c22c8c82cc51fa84c70efb1b7ab99 (patch)
tree6adb7cdaf0b597a9f027b2d9112f25c5cc45cdec
parent2aea1d796ea60b9e49d12257dc2a94bf3dd4ef26 (diff)
Update.
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.
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/posix/mkstemp.c2
-rw-r--r--sysdeps/posix/mktemp.c6
3 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index fc4f3b878a..f88e5ac2d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/sysdeps/posix/mkstemp.c b/sysdeps/posix/mkstemp.c
index b3c8b64021..3d8be9cc9c 100644
--- a/sysdeps/posix/mkstemp.c
+++ b/sysdeps/posix/mkstemp.c
@@ -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)
{
diff --git a/sysdeps/posix/mktemp.c b/sysdeps/posix/mktemp.c
index 6bbc4c0ce9..ad5cb1daf5 100644
--- a/sysdeps/posix/mktemp.c
+++ b/sysdeps/posix/mktemp.c
@@ -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];