cleanups spotted by irix cc

This commit is contained in:
Russ Cox
2005-12-29 23:15:58 +00:00
parent 3c84c725ef
commit 21b830b1ac
8 changed files with 22 additions and 42 deletions

View File

@ -126,6 +126,7 @@ tramp(void *vp)
/* BUG: leaks Proc */
pthread_setspecific(prdakey, 0);
pthread_exit(0);
return 0;
}
void
@ -161,20 +162,32 @@ int randfd;
void
randominit(void)
{
#ifdef USE_RANDOM
srandom(getpid()+fastticks(nil)+ticks());
#else
if((randfd = open("/dev/urandom", OREAD)) < 0)
if((randfd = open("/dev/random", OREAD)) < 0)
panic("open /dev/random: %r");
#endif
}
#undef read
ulong
randomread(void *v, ulong n)
{
#ifdef USE_RANDOM
int i;
for(i=0; i<n; i++)
((uchar*)v)[i] = random();
return n;
#else
int m;
if((m = read(randfd, v, n)) != n)
panic("short read from /dev/random: %d but %d", n, m);
return m;
#endif
}
#undef time