File 0001-netmgr-ensure-file-descriptors-0-2-are-in-use-before.patch of Package bind
From 93a3e6174826ab41362115ac4264a0ee567ad6ea Mon Sep 17 00:00:00 2001
From: Thomas Abraham <tabraham@suse.com>
Date: Tue, 3 Jun 2025 17:48:02 -0400
Subject: [PATCH] netmgr: ensure file descriptors 0-2 are in use before
invoking libuv functions
libuv expect file descriptors <= STDERR_FILENO are in use. otherwise,
it may abort when closing a file descriptor it opened.
Closes #5226
--- a/bin/dig/dighost.c
+++ b/bin/dig/dighost.c
@@ -1351,6 +1351,22 @@
debug("setup_libs()");
+ /*
+ * Work around stupidity in libuv where it aborts when closing
+ * file descriptors that it opened by ensuring the first 3 file
+ * descriptors are open.
+ */
+ do {
+ int fd = open("/dev/null", O_RDWR, 0);
+ if (fd > STDERR_FILENO) {
+ close(fd);
+ break;
+ }
+ if (fd < 0) {
+ break;
+ }
+ } while(1);
+
result = isc_net_probeipv4();
if (result == ISC_R_SUCCESS) {
have_ipv4 = true;