Skip to content

Commit

Permalink
tools: bpftool: use correct argument in cgroup errors
Browse files Browse the repository at this point in the history
cgroup code tries to use argv[0] as the cgroup path,
but if it fails uses argv[1] to report errors.

Fixes: 5ccda64 ("bpftool: implement cgroup bpf operations")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Jakub Kicinski authored and borkmann committed Jun 26, 2019
1 parent f7019b7 commit 6c6874f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/bpf/bpftool/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int do_show(int argc, char **argv)

cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) {
p_err("can't open cgroup %s", argv[1]);
p_err("can't open cgroup %s", argv[0]);
goto exit;
}

Expand Down Expand Up @@ -356,7 +356,7 @@ static int do_attach(int argc, char **argv)

cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) {
p_err("can't open cgroup %s", argv[1]);
p_err("can't open cgroup %s", argv[0]);
goto exit;
}

Expand Down Expand Up @@ -414,7 +414,7 @@ static int do_detach(int argc, char **argv)

cgroup_fd = open(argv[0], O_RDONLY);
if (cgroup_fd < 0) {
p_err("can't open cgroup %s", argv[1]);
p_err("can't open cgroup %s", argv[0]);
goto exit;
}

Expand Down

0 comments on commit 6c6874f

Please sign in to comment.