aboutsummaryrefslogtreecommitdiffstats
path: root/lib/path.c
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2023-10-10 21:00:48 +0200
committerTobias Stoeckmann <tobias@stoeckmann.org>2023-10-10 21:00:48 +0200
commit297fc55bae06aabeda0d1e9549c45a1ac5f3f900 (patch)
tree0b4fd2e0a1a667b6e07d6ca3f555caaa58884ea8 /lib/path.c
parent970f3e5a31cabcd0e9f7df4d9a90721020517a82 (diff)
downloadutil-linux-297fc55bae06aabeda0d1e9549c45a1ac5f3f900.tar.gz
lib/path: Set errno in case of fgets failure
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'lib/path.c')
-rw-r--r--lib/path.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/path.c b/lib/path.c
index c878d2d962..202f19ac4f 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -1016,7 +1016,12 @@ static int ul_path_cpuparse(struct path_cxt *pc, cpu_set_t **set, int maxcpus, i
goto out;
}
- rc = fgets(buf, len, f) == NULL ? -EIO : 0;
+ if (fgets(buf, len, f) == NULL) {
+ errno = EIO;
+ rc = -errno;
+ } else
+ rc = 0;
+
fclose(f);
if (rc)