Correct incorrect type-punning fixes
[openafs.git] / src / util / uuid.c
index afc8b7a..6238c9c 100644 (file)
@@ -49,8 +49,6 @@
 #include <afs/param.h>
 #endif
 
-RCSID
-    ("$Header$");
 
 #ifdef KERNEL
 #include "afs/sysincludes.h"
@@ -60,6 +58,7 @@ RCSID
 #else /* KERNEL */
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 #ifdef AFS_NT40_ENV
 #include <winsock2.h>
 #include <process.h>
@@ -73,13 +72,6 @@ RCSID
 #include <sys/time.h>
 #endif /* ITIMER_REAL */
 #include <net/if.h>
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -256,7 +248,7 @@ afs_uuid_create(afsUUID * uuid)
 
     if (!uuid_init_done) {
        uuid_time_t t;
-       u_short *seedp, seed = 0;
+       u_short seedp[4], seed = 0;
        rand_m = 971;;
        rand_ia = 11113;
        rand_ib = 104322;
@@ -273,13 +265,15 @@ afs_uuid_create(afsUUID * uuid)
         * are multiple processes creating UUID's on a system, we add in the PID.
         */
        uuid__get_os_time(&t);
-       seedp = (u_short *) (&t);
-       seed ^= *seedp++;
-       seed ^= *seedp++;
-       seed ^= *seedp++;
-       seed ^= *seedp++;
+       memcpy(&seedp, &t, sizeof(seedp));
+       seed ^= seedp[0];
+       seed ^= seedp[1];
+       seed ^= seedp[2];
+       seed ^= seedp[3];
 #if defined(KERNEL) && defined(AFS_XBSD_ENV)
        rand_irand += seed + (afs_uint32) curproc->p_pid;
+#elif defined(UKERNEL)
+       rand_irand += seed + (afs_uint32) osi_getpid();
 #else
        rand_irand += seed + (afs_uint32) getpid();
 #endif
@@ -418,7 +412,7 @@ uuid_get_address(uuid_address_p_t addr)
 void
 uuid__get_os_time(uuid_time_t * os_time)
 {
-    struct timeval tp;
+    osi_timeval_t tp;
 
     osi_GetTime(&tp);
     os_time->hi = tp.tv_sec;