diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c index 3689d8fdd..3220d7659 100644 --- a/dirmngr/dns-stuff.c +++ b/dirmngr/dns-stuff.c @@ -42,6 +42,7 @@ # include #endif #include +#include #ifdef USE_ADNS # include #endif @@ -1103,9 +1104,16 @@ getsrv (const char *name,struct srventry **list) /* Run the RFC-2782 weighting algorithm. We don't need very high quality randomness for this, so regular libc srand/rand is - sufficient. Fixme: It is a bit questionaly to reinitalize srand - - better use a gnupg fucntion for this. */ - srand(time(NULL)*getpid()); + sufficient. */ + + { + static int done; + if (!done) + { + done = 1; + srand (time (NULL)*getpid()); + } + } for (i=0; i < srvcount; i++) { diff --git a/dirmngr/t-dns-stuff.c b/dirmngr/t-dns-stuff.c index 4ecbd64f0..191b581b4 100644 --- a/dirmngr/t-dns-stuff.c +++ b/dirmngr/t-dns-stuff.c @@ -205,15 +205,14 @@ main (int argc, char **argv) struct srventry *srv; int rc,i; - rc=getsrv("_hkp._tcp.wwwkeys.pgp.net",&srv); - printf("Count=%d\n\n",rc); + rc=getsrv (name? name : "_hkp._tcp.wwwkeys.pgp.net", &srv); + printf("Count=%d\n",rc); for(i=0;i