iscsi_create_context() calls srand() every time a new context is generated. That practice is questionable, as the seed does not need to change before each call to rand(). As a matter of fact, doing so defeats the purpose of using rand() altogether. Furthermore, the current implementation is not thread safe. This improves ISID generation by using /dev/urandom (when available) as a seed, and calling srand() only once. In case of errors, fallback to using something similar to the previous implementation (albeit thread-safe). Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
19 KiB
19 KiB