diff options
| author | Tobias Stoeckmann <tobias@stoeckmann.org> | 2023-10-10 21:00:48 +0200 |
|---|---|---|
| committer | Tobias Stoeckmann <tobias@stoeckmann.org> | 2023-10-10 21:00:48 +0200 |
| commit | 297fc55bae06aabeda0d1e9549c45a1ac5f3f900 (patch) | |
| tree | 0b4fd2e0a1a667b6e07d6ca3f555caaa58884ea8 /lib/path.c | |
| parent | 970f3e5a31cabcd0e9f7df4d9a90721020517a82 (diff) | |
| download | util-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.c | 7 |
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) |
