* [PATCH bpf] tools: bpftool: use correct argument in cgroup errors
@ 2019-06-25 16:56 Jakub Kicinski
2019-06-25 17:21 ` Roman Gushchin
2019-06-26 14:30 ` Daniel Borkmann
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2019-06-25 16:56 UTC (permalink / raw)
To: alexei.starovoitov, daniel
Cc: netdev, bpf, oss-drivers, guro, sdf, Jakub Kicinski, Quentin Monnet
cgroup code tries to use argv[0] as the cgroup path,
but if it fails uses argv[1] to report errors.
Fixes: 5ccda64d38cc ("bpftool: implement cgroup bpf operations")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
tools/bpf/bpftool/cgroup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c
index 73ec8ea33fb4..a13fb7265d1a 100644
--- a/tools/bpf/bpftool/cgroup.c
+++ b/tools/bpf/bpftool/cgroup.c
@@ -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;
}
@@ -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;
}
@@ -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;
}
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] tools: bpftool: use correct argument in cgroup errors
2019-06-25 16:56 [PATCH bpf] tools: bpftool: use correct argument in cgroup errors Jakub Kicinski
@ 2019-06-25 17:21 ` Roman Gushchin
2019-06-26 14:30 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Roman Gushchin @ 2019-06-25 17:21 UTC (permalink / raw)
To: Jakub Kicinski
Cc: alexei.starovoitov, daniel, netdev, bpf, oss-drivers, sdf,
Quentin Monnet
On Tue, Jun 25, 2019 at 09:56:31AM -0700, Jakub Kicinski wrote:
> cgroup code tries to use argv[0] as the cgroup path,
> but if it fails uses argv[1] to report errors.
>
> Fixes: 5ccda64d38cc ("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>
Thanks, Jakub!
> ---
> tools/bpf/bpftool/cgroup.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/bpf/bpftool/cgroup.c b/tools/bpf/bpftool/cgroup.c
> index 73ec8ea33fb4..a13fb7265d1a 100644
> --- a/tools/bpf/bpftool/cgroup.c
> +++ b/tools/bpf/bpftool/cgroup.c
> @@ -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;
> }
>
> @@ -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;
> }
>
> @@ -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;
> }
>
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] tools: bpftool: use correct argument in cgroup errors
2019-06-25 16:56 [PATCH bpf] tools: bpftool: use correct argument in cgroup errors Jakub Kicinski
2019-06-25 17:21 ` Roman Gushchin
@ 2019-06-26 14:30 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-06-26 14:30 UTC (permalink / raw)
To: Jakub Kicinski, alexei.starovoitov
Cc: netdev, bpf, oss-drivers, guro, sdf, Quentin Monnet
On 06/25/2019 06:56 PM, Jakub Kicinski wrote:
> cgroup code tries to use argv[0] as the cgroup path,
> but if it fails uses argv[1] to report errors.
>
> Fixes: 5ccda64d38cc ("bpftool: implement cgroup bpf operations")
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-26 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 16:56 [PATCH bpf] tools: bpftool: use correct argument in cgroup errors Jakub Kicinski
2019-06-25 17:21 ` Roman Gushchin
2019-06-26 14:30 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).