From: Florian Weimer <fweimer@redhat.com>
To: "Cristian Rodríguez" <crrodriguez@opensuse.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 2/2] resolv: make res_randomid use random_bits()
Date: Fri, 20 Aug 2021 09:00:51 +0200 [thread overview]
Message-ID: <87r1eoy50c.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20210806191749.4620-2-crrodriguez@opensuse.org> ("Cristian =?utf-8?Q?Rodr=C3=ADguez=22's?= message of "Fri, 6 Aug 2021 15:17:49 -0400")
* Cristian Rodríguez:
> It is at least "more random" than 0xffff & __getpid ();
>
> Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
> ---
> resolv/res_randomid.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/resolv/res_randomid.c b/resolv/res_randomid.c
> index 546daf4c8b..08a52a111a 100644
> --- a/resolv/res_randomid.c
> +++ b/resolv/res_randomid.c
> @@ -84,9 +84,10 @@
>
> #include <resolv.h>
> #include <unistd.h>
> +#include <random-bits.h>
>
> unsigned int
> res_randomid (void) {
> - return 0xffff & __getpid ();
> + return random_bits();
> }
> libc_hidden_def (__res_randomid)
The masking with 0xffff needs to remain, and there should be a space
before ().
Thanks,
Florian
next prev parent reply other threads:[~2021-08-20 7:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 19:17 [PATCH 1/2] Linux: implement getloadavg(3) using sysinfo(2) Cristian Rodríguez
2021-08-06 19:17 ` [PATCH 2/2] resolv: make res_randomid use random_bits() Cristian Rodríguez
2021-08-12 18:51 ` Cristian Rodríguez
2021-08-20 7:00 ` Florian Weimer [this message]
2021-08-20 13:23 ` Cristian Rodríguez
2021-08-12 18:51 ` [PATCH 1/2] Linux: implement getloadavg(3) using sysinfo(2) Cristian Rodríguez
2021-08-19 19:17 ` Adhemerval Zanella
2021-08-19 21:38 ` Cristian Rodríguez
2021-08-20 14:21 ` Adhemerval Zanella
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r1eoy50c.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=crrodriguez@opensuse.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).