s4-messaging: Use generate_random() to get a unique ID for messaging clients
authorAndrew Bartlett <abartlet@samba.org>
Wed, 25 Apr 2012 07:53:18 +0000 (17:53 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 25 Apr 2012 09:43:40 +0000 (11:43 +0200)
The call to random() resulted in duplicate values for s3fs configurations
which, due to the forked child, all started with the same random seed.

A future improvement would be to move to a proven unique value.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Apr 25 11:43:40 CEST 2012 on sn-devel-104

source4/lib/messaging/messaging.c

index 9c337f65a581d5d70834211c0681dc2c1f83d130..80812c2885081a4a399843ab96204d45c8fddef5 100644 (file)
@@ -663,7 +663,8 @@ struct imessaging_context *imessaging_client_init(TALLOC_CTX *mem_ctx,
 {
        struct server_id id;
        ZERO_STRUCT(id);
-       id.pid = random() % 0x10000000;
+       id.pid = generate_random() % 0x10000000;
+
        return imessaging_init(mem_ctx, lp_ctx, id, ev, true);
 }
 /*