Commit 46333129 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by Greg Kroah-Hartman

tools: bpftool: use correct argument in cgroup errors

[ Upstream commit 6c6874f4 ]

cgroup code tries to use argv[0] as the cgroup path,
but if it fails uses argv[1] to report errors.

Fixes: 5ccda64d ("bpftool: implement cgroup bpf operations")
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Acked-by: default avatarRoman Gushchin <guro@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 3fda8925
...@@ -164,7 +164,7 @@ static int do_show(int argc, char **argv) ...@@ -164,7 +164,7 @@ static int do_show(int argc, char **argv)
cgroup_fd = open(argv[0], O_RDONLY); cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) { if (cgroup_fd < 0) {
p_err("can't open cgroup %s", argv[1]); p_err("can't open cgroup %s", argv[0]);
goto exit; goto exit;
} }
...@@ -345,7 +345,7 @@ static int do_attach(int argc, char **argv) ...@@ -345,7 +345,7 @@ static int do_attach(int argc, char **argv)
cgroup_fd = open(argv[0], O_RDONLY); cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) { if (cgroup_fd < 0) {
p_err("can't open cgroup %s", argv[1]); p_err("can't open cgroup %s", argv[0]);
goto exit; goto exit;
} }
...@@ -403,7 +403,7 @@ static int do_detach(int argc, char **argv) ...@@ -403,7 +403,7 @@ static int do_detach(int argc, char **argv)
cgroup_fd = open(argv[0], O_RDONLY); cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) { if (cgroup_fd < 0) {
p_err("can't open cgroup %s", argv[1]); p_err("can't open cgroup %s", argv[0]);
goto exit; goto exit;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment