File 0002-ucm-exec-fix-maxfd-used-warning.patch of Package alsa
From 813ffe34ff6c720dcc56e4549338bf9e9184af1f Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 9 Dec 2025 17:48:34 +0100
Subject: [PATCH 2/7] ucm: exec - fix maxfd used warning
Fixes: a068cf08 ("ucm: use closefrom instead of close_range")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/ucm/ucm_exec.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/ucm/ucm_exec.c b/src/ucm/ucm_exec.c
index 713039b4920f..c16a4cfdaec0 100644
--- a/src/ucm/ucm_exec.c
+++ b/src/ucm/ucm_exec.c
@@ -183,7 +183,7 @@ static int parse_args(char ***argv, int argc, const char *cmd)
*/
int uc_mgr_exec(const char *prog)
{
- pid_t p, f, maxfd;
+ pid_t p, f;
int err = 0, status;
char bin[PATH_MAX];
struct sigaction sa;
@@ -212,8 +212,6 @@ int uc_mgr_exec(const char *prog)
prog = bin;
}
- maxfd = sysconf(_SC_OPEN_MAX);
-
/*
* block SIGCHLD signal
* ignore SIGINT and SIGQUIT in parent
@@ -262,8 +260,11 @@ int uc_mgr_exec(const char *prog)
#if HAVE_DECL_CLOSEFROM
closefrom(3);
#else
- for (f = 3; f < maxfd; f++)
- close(f);
+ {
+ pid_t maxfd = sysconf(_SC_OPEN_MAX);
+ for (f = 3; f < maxfd; f++)
+ close(f);
+ }
#endif
/* install default handlers for the forked process */
--
2.52.0