tools: bpftool: fix completion for "bpftool map update"
authorQuentin Monnet <quentin.monnet@netronome.com>
Sat, 20 Oct 2018 22:01:50 +0000 (23:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Dec 2019 08:16:47 +0000 (09:16 +0100)
commit083757d848597e5e33528c931751ceb8a98bc6c0
tree69d086d5b8234d2e5465c13c091d6fcf80712279
parent570c05378d971ab29e6e67500c8b0e6fdd19dc93
tools: bpftool: fix completion for "bpftool map update"

[ Upstream commit fe8ecccc10b3adc071de05ca7af728ca1a4ac9aa ]

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: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/bpf/bpftool/bash-completion/bpftool