From: Tobias Stoeckmann Date: Tue, 10 Oct 2023 19:00:48 +0000 (+0200) Subject: lib/path: Set errno in case of fgets failure X-Git-Tag: v2.40-rc1~207^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=297fc55bae06aabeda0d1e9549c45a1ac5f3f900;p=thirdparty%2Futil-linux.git lib/path: Set errno in case of fgets failure Signed-off-by: Tobias Stoeckmann --- 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)