From 0e1762539c2ad359ba10502cdfb750b5afd2329e Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 13 Jun 2011 20:52:01 -0400 Subject: [PATCH] avoid 64bit warnings when using pointers as entropy for temp names --- src/stdio/tempnam.c | 3 ++- src/stdio/tmpnam.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/stdio/tempnam.c b/src/stdio/tempnam.c index dc4f2bad..f73ca9f9 100644 --- a/src/stdio/tempnam.c +++ b/src/stdio/tempnam.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include "libc.h" @@ -30,7 +31,7 @@ char *tempnam(const char *dir, const char *pfx) do { clock_gettime(CLOCK_REALTIME, &ts); - n = ts.tv_nsec ^ (unsigned)&s ^ (unsigned)s; + n = ts.tv_nsec ^ (uintptr_t)&s ^ (uintptr_t)s; snprintf(s, l, "%s/%s-%d-%d-%x", dir, pfx, pid, a_fetch_add(&index, 1), n); } while (!access(s, F_OK) && try++=MAXTRIES) { diff --git a/src/stdio/tmpnam.c b/src/stdio/tmpnam.c index 010cf039..2bd72b3b 100644 --- a/src/stdio/tmpnam.c +++ b/src/stdio/tmpnam.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include "libc.h" @@ -23,7 +24,7 @@ char *tmpnam(char *s) do { __syscall(SYS_clock_gettime, CLOCK_REALTIME, &ts, 0); - n = ts.tv_nsec ^ (unsigned)&s ^ (unsigned)s; + n = ts.tv_nsec ^ (uintptr_t)&s ^ (uintptr_t)s; snprintf(s, L_tmpnam, "/tmp/t%x-%x", a_fetch_add(&index, 1), n); } while (!__syscall(SYS_access, s, F_OK) && try++=MAXTRIES ? 0 : s; -- 2.20.1