]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
lib: fix checking of returned file handle size for cgroup
authorDmitry Yakunin <zeil@yandex-team.ru>
Sun, 5 Jul 2020 16:18:12 +0000 (19:18 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 6 Jul 2020 18:05:54 +0000 (11:05 -0700)
Before this patch check is happened only in case when we try to find
cgroup at cgroup2 mount point.

v2:
  - add Fixes line before Signed-off-by (David Ahern)

Fixes: d5e6ee0dac64 ("ss: introduce cgroup2 cache and helper functions")
Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
lib/fs.c

index e265fc04eaec5ae62ce524500a5448145b2ecd54..4b90a704647ab6dc446de2f7a4edf8d09ecb3bdd 100644 (file)
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -148,10 +148,10 @@ __u64 get_cgroup2_id(const char *path)
                                        strerror(errno));
                        goto out;
                }
-               if (fhp->handle_bytes != sizeof(__u64)) {
-                       fprintf(stderr, "Invalid size of cgroup2 ID\n");
-                       goto out;
-               }
+       }
+       if (fhp->handle_bytes != sizeof(__u64)) {
+               fprintf(stderr, "Invalid size of cgroup2 ID\n");
+               goto out;
        }
 
        memcpy(cg_id.bytes, fhp->f_handle, sizeof(__u64));