1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

dirmngr: Minor cleanup of the SRV RR code.

* dirmngr/dns-stuff.c: Include unistd.h.
(getsrv): Run srand only once.
* dirmngr/t-dns-stuff.c (main): Allow passing another name for --srv
and change output format.
This commit is contained in:
Werner Koch 2015-10-28 10:14:07 +01:00
parent e026efb436
commit 949a5cfdab
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
2 changed files with 16 additions and 9 deletions

View file

@ -42,6 +42,7 @@
# include <netdb.h>
#endif
#include <string.h>
#include <unistd.h>
#ifdef USE_ADNS
# include <adns.h>
#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++)
{