From: Maarten B. <maa...@mi...> - 2003-04-15 19:26:04
|
Hi, It might be stating the obvious ... but it is always a GoodIdea(tm) to check the return values of system calls. Cheers, Maarten. On Tue, 2003-04-15 at 16:41, Philippe Elie wrote: > Sebastian wrote: > > Hi, > > > > > unsigned int > > be_random (unsigned int max) > > { > > unsigned int tmp; > > > > > > if (rand_fd == -1) > > be_randinit (); > > > > read (rand_fd, &tmp, sizeof (tmp)); > > > > /* 0 denotes special 0 to 2^32 - 1 range > > */ > > if (max == 0) > > return (tmp); > > > > return (tmp % max); > > } > > > > In any case, there is no way for be_random to return without defining > %eax. > > if read fails tmp is not initialized > > regards, > Philippe Elie -- Maarten Ballintijn <maa...@mi...> Massachusetts Institute of Technology |