"Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote: ... >> Also, unless there's a guarantee that the random number state is >> initialized elsewhere, it should be initialized here, like it was in >> the now-removed xenXMAutoAssignMac function. >> >> srand((unsigned)time(NULL)); >> >> Or maybe just initialize it once at start-up? > > Could just add a call to srand() in virInitialize() i guess, although is > that a reasonable thing for a shared library to be doing, rather than > leaving it upto the application ? You're right that it's not reasonable to call srand from library code. One alternative is to use something like coreutils' gnulib-style randint module. I'm looking into whether we can relax it's GPL license to LGPLv2+. Using it or any other library-safe random_r-like interface would mean maintaining and reusing an internal-to-libvirt random state buffer. -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list