]> git.alsa-project.org Git - alsa-lib.git/commitdiff
ucm: fix fd-closing fallback and waitpid signal handling in uc_mgr_exec
authorJaroslav Kysela <perex@perex.cz>
Mon, 30 Nov 2026 14:31:00 +0000 (15:31 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 30 Nov 2026 14:32:02 +0000 (15:32 +0100)
Use fallback value 1024 when sysconf(_SC_OPEN_MAX) fails.
The blocking waitpid() may return also EINTR.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/ucm/ucm_exec.c

index fdd887989672a3e73e8457463f97f007d13cc7e6..60e0d745cb504ce320b684fcff4f9ac39ccfad1f 100644 (file)
@@ -262,6 +262,8 @@ int uc_mgr_exec(const char *prog)
 #else
                {
                        long maxfd = sysconf(_SC_OPEN_MAX);
+                       if (maxfd < 0)
+                               maxfd = 1024;
                        for (f = 3; f < maxfd; f++)
                                close(f);
                }
@@ -289,7 +291,7 @@ int uc_mgr_exec(const char *prog)
        while (1) {
                pid_t r = waitpid(p, &status, 0);
                if (r == -1) {
-                       if (errno == EAGAIN)
+                       if (errno == EINTR || errno == EAGAIN)
                                continue;
                        err = -errno;
                        goto __error;