On Fri, Aug 16, 2013 at 06:01:25PM +0200, Stéphane Graber wrote:
> On Fri, Aug 16, 2013 at 10:36:58AM -0500, Serge Hallyn wrote:
> > Quoting Stéphane Graber (stgra...@ubuntu.com):
> > > initstate/random doesn't work on bionic, srand/rand works on everything,
> > > so let's use that.
> > 
> > Is rand_r available on bionic?
> > 
> > rand() isn't thread-safe.
> 
> Unfortunately no, I actually don't think Bionic has any of the _r
> functions.
> 
> Is it actually a problem in this case? It looks like the worst that
> could happen is that the random number generator gets re-seeded from
> urandom between two calls, which would just make it even more random,
> no?

I don't think that's a safe assumption.  You could have an rand()
call overlap with a srand() call, causing rand() to access invalid
state which may cause it to return a non-random number.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to