author | Rich Felker <dalias@aerifal.cx> | 2011年06月13日 20:52:01 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011年06月13日 20:52:01 -0400 |
commit | 0e1762539c2ad359ba10502cdfb750b5afd2329e (patch) | |
tree | 09fb60c4a8bd35f5ba16b828b79bc71759dd55f0 /src/stdio/tmpnam.c | |
parent | f09e78de983a8d1daf2f6e071a998eb615f1ce67 (diff) | |
download | musl-0e1762539c2ad359ba10502cdfb750b5afd2329e.tar.gz |
-rw-r--r-- | src/stdio/tmpnam.c | 3 |
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 <stdio.h> #include <stdlib.h> +#include <stdint.h> #include <unistd.h> #include <time.h> #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); return try>=MAXTRIES ? 0 : s; |