From f8ab70477e2ca7ac050fd4e2337b76a1972c8aa3 Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Sun, 8 Oct 2023 20:47:53 +0200 Subject: [PATCH] lib/path: set errno in case of error Some programs like lscpu expect errno to be set if ul_path_cpuparse fails. [kzak@redhat.com: - backport to stable/v2.39] Signed-off-by: Tobias Stoeckmann Signed-off-by: Karel Zak --- lib/path.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/path.c b/lib/path.c index 1a8a21c124..258fa048d6 100644 --- a/lib/path.c +++ b/lib/path.c @@ -1046,12 +1046,16 @@ 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)) { cpuset_free(*set); - return -EINVAL; + errno = EINVAL; + rc = -errno; + return rc; } } else { if (cpumask_parse(buf, *set, setsize)) { cpuset_free(*set); - return -EINVAL; + errno = EINVAL; + rc = -errno; + return rc; } } return 0; -- 2.47.2