File 0001-netmgr-ensure-file-descriptors-0-2-are-in-use-before.patch.v2 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/host.c
+++ b/bin/dig/host.c
@@ -18,6 +18,8 @@
#include <locale.h>
#include <stdbool.h>
#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
#include <isc/attributes.h>
#include <isc/commandline.h>
@@ -932,6 +915,23 @@
debug("main()");
progname = argv[0];
pre_parse_args(argc, argv);
+
+ /*
+ * 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);
+
setup_libs();
setup_system(ipv4only, ipv6only);
parse_args(false, argc, argv);