]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/path: set errno in case of error
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 8 Oct 2023 18:47:53 +0000 (20:47 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 8 Oct 2023 18:47:53 +0000 (20:47 +0200)
Some programs like lscpu expect errno to be set if ul_path_cpuparse
fails.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
lib/path.c

index 53bb7986874add61c0250e2b1c6432f3fb662384..9232755ae2356a588965fd402bce573191ce0b30 100644 (file)
@@ -1053,12 +1053,14 @@ static int ul_path_cpuparse(struct path_cxt *pc, cpu_set_t **set, int maxcpus, i
 
        if (islist) {
                if (cpulist_parse(buf, *set, setsize, 0)) {
-                       rc = -EINVAL;
+                       errno = EINVAL;
+                       rc = -errno;
                        goto out;
                }
        } else {
                if (cpumask_parse(buf, *set, setsize)) {
-                       rc = -EINVAL;
+                       errno = EINVAL;
+                       rc = -errno;
                        goto out;
                }
        }