Commit 083757d8 authored by Quentin Monnet's avatar Quentin Monnet Committed by Greg Kroah-Hartman

tools: bpftool: fix completion for "bpftool map update"

[ Upstream commit fe8ecccc ]

When trying to complete "bpftool map update" commands, the call to
printf would print an error message that would show on the command line
if no map is found to complete the command line.

Fix it by making sure we have map ids to complete the line with, before
we try to print something.
Signed-off-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 570c0537
...@@ -143,7 +143,7 @@ _bpftool_map_update_map_type() ...@@ -143,7 +143,7 @@ _bpftool_map_update_map_type()
local type local type
type=$(bpftool -jp map show $keyword $ref | \ type=$(bpftool -jp map show $keyword $ref | \
command sed -n 's/.*"type": "\(.*\)",$/\1/p') command sed -n 's/.*"type": "\(.*\)",$/\1/p')
printf $type [[ -n $type ]] && printf $type
} }
_bpftool_map_update_get_id() _bpftool_map_update_get_id()
......
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