* [PATCH] Fix build when HAS_GETRANDOM is undefined
@ 2026-02-23 17:27 Peter Foley
2026-02-24 5:47 ` David Gibson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Peter Foley @ 2026-02-23 17:27 UTC (permalink / raw)
To: passt-dev; +Cc: Peter Foley
e.g.
util.c:1163:14: error: use of undeclared identifier 'dev_random'; did you mean 'raw_random'?
1163 | ret = read(dev_random, (char *)buf + random_read,
Signed-off-by: Peter Foley <pefoley@google.com>
---
util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util.c b/util.c
index db27431..a4f2be4 100644
--- a/util.c
+++ b/util.c
@@ -1160,7 +1160,7 @@ void raw_random(void *buf, size_t buflen)
ret = getrandom((char *)buf + random_read,
buflen - random_read, GRND_RANDOM);
#else
- ret = read(dev_random, (char *)buf + random_read,
+ ret = read(fd, (char *)buf + random_read,
buflen - random_read);
#endif
@@ -1177,7 +1177,7 @@ void raw_random(void *buf, size_t buflen)
}
#ifndef HAS_GETRANDOM
- close(dev_random);
+ close(fd);
#endif
if (random_read < buflen)
--
2.53.0.371.g1d285c8824-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix build when HAS_GETRANDOM is undefined
2026-02-23 17:27 [PATCH] Fix build when HAS_GETRANDOM is undefined Peter Foley
@ 2026-02-24 5:47 ` David Gibson
2026-02-24 8:01 ` Laurent Vivier
2026-02-24 11:57 ` Stefano Brivio
2 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2026-02-24 5:47 UTC (permalink / raw)
To: Peter Foley; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1331 bytes --]
On Mon, Feb 23, 2026 at 12:27:39PM -0500, Peter Foley wrote:
> e.g.
> util.c:1163:14: error: use of undeclared identifier 'dev_random'; did you mean 'raw_random'?
> 1163 | ret = read(dev_random, (char *)buf + random_read,
>
> Signed-off-by: Peter Foley <pefoley@google.com>
Oops, that's mildly embarrassing.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> util.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/util.c b/util.c
> index db27431..a4f2be4 100644
> --- a/util.c
> +++ b/util.c
> @@ -1160,7 +1160,7 @@ void raw_random(void *buf, size_t buflen)
> ret = getrandom((char *)buf + random_read,
> buflen - random_read, GRND_RANDOM);
> #else
> - ret = read(dev_random, (char *)buf + random_read,
> + ret = read(fd, (char *)buf + random_read,
> buflen - random_read);
> #endif
>
> @@ -1177,7 +1177,7 @@ void raw_random(void *buf, size_t buflen)
> }
>
> #ifndef HAS_GETRANDOM
> - close(dev_random);
> + close(fd);
> #endif
>
> if (random_read < buflen)
> --
> 2.53.0.371.g1d285c8824-goog
>
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix build when HAS_GETRANDOM is undefined
2026-02-23 17:27 [PATCH] Fix build when HAS_GETRANDOM is undefined Peter Foley
2026-02-24 5:47 ` David Gibson
@ 2026-02-24 8:01 ` Laurent Vivier
2026-02-24 11:57 ` Stefano Brivio
2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2026-02-24 8:01 UTC (permalink / raw)
To: Peter Foley, passt-dev
On 2/23/26 18:27, Peter Foley wrote:
> e.g.
> util.c:1163:14: error: use of undeclared identifier 'dev_random'; did you mean 'raw_random'?
> 1163 | ret = read(dev_random, (char *)buf + random_read,
>
> Signed-off-by: Peter Foley <pefoley@google.com>
> ---
> util.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/util.c b/util.c
> index db27431..a4f2be4 100644
> --- a/util.c
> +++ b/util.c
> @@ -1160,7 +1160,7 @@ void raw_random(void *buf, size_t buflen)
> ret = getrandom((char *)buf + random_read,
> buflen - random_read, GRND_RANDOM);
> #else
> - ret = read(dev_random, (char *)buf + random_read,
> + ret = read(fd, (char *)buf + random_read,
> buflen - random_read);
> #endif
>
> @@ -1177,7 +1177,7 @@ void raw_random(void *buf, size_t buflen)
> }
>
> #ifndef HAS_GETRANDOM
> - close(dev_random);
> + close(fd);
> #endif
>
> if (random_read < buflen)
Fixes: 71d5deed5eed ("util: Add general low-level random bytes helper")
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix build when HAS_GETRANDOM is undefined
2026-02-23 17:27 [PATCH] Fix build when HAS_GETRANDOM is undefined Peter Foley
2026-02-24 5:47 ` David Gibson
2026-02-24 8:01 ` Laurent Vivier
@ 2026-02-24 11:57 ` Stefano Brivio
2 siblings, 0 replies; 4+ messages in thread
From: Stefano Brivio @ 2026-02-24 11:57 UTC (permalink / raw)
To: Peter Foley; +Cc: passt-dev, David Gibson, Laurent Vivier
On Mon, 23 Feb 2026 12:27:39 -0500
Peter Foley <pefoley@google.com> wrote:
> e.g.
> util.c:1163:14: error: use of undeclared identifier 'dev_random'; did you mean 'raw_random'?
> 1163 | ret = read(dev_random, (char *)buf + random_read,
>
> Signed-off-by: Peter Foley <pefoley@google.com>
Applied, thanks for fixing this, and welcome to the git log!
--
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-24 11:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-23 17:27 [PATCH] Fix build when HAS_GETRANDOM is undefined Peter Foley
2026-02-24 5:47 ` David Gibson
2026-02-24 8:01 ` Laurent Vivier
2026-02-24 11:57 ` Stefano Brivio
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).