aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-08-21 15:04:01 +1000
committerStefano Brivio <sbrivio@redhat.com>2026-09-08 16:11:26 +0200
commitcf3a11f40210248d80194be2d5404ababeaeb17f (patch)
treef1aa83012e3f8941737a1c2a4a819f4fc7ce6932
parentabdc94a25679259ee88418a48145a264b37f7794 (diff)
downloadpasst-cf3a11f40210248d80194be2d5404ababeaeb17f.tar
passt-cf3a11f40210248d80194be2d5404ababeaeb17f.tar.gz
passt-cf3a11f40210248d80194be2d5404ababeaeb17f.tar.bz2
passt-cf3a11f40210248d80194be2d5404ababeaeb17f.tar.lz
passt-cf3a11f40210248d80194be2d5404ababeaeb17f.tar.xz
passt-cf3a11f40210248d80194be2d5404ababeaeb17f.tar.zst
passt-cf3a11f40210248d80194be2d5404ababeaeb17f.zip
util: Add missing O_CLOEXEC for !HAS_GETRANDOM path
It rarely matters, since we usually have getrandom(), but in case we don't our open() of /dev/random was missing O_CLOEXEC, which can cause clang warnings. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util.c b/util.c
index 7c97910..6a39d2d 100644
--- a/util.c
+++ b/util.c
@@ -964,7 +964,7 @@ void raw_random(void *buf, size_t buflen)
{
size_t random_read = 0;
#ifndef HAS_GETRANDOM
- int fd = open(DEV_RANDOM, O_RDONLY);
+ int fd = open(DEV_RANDOM, O_RDONLY | O_CLOEXEC);
if (fd < 0)
die_perror("Couldn't open %s", DEV_RANDOM);