summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2017-10-19 15:46:23 -0700
committerDavid S. Miller <davem@davemloft.net>2017-10-22 02:11:32 +0100
commitd9c0b48db9f4b870535b6d7255638347e770633f (patch)
treec373c28c054cc51a8778441e22d753a3fead5778
parent9f606179c84930ada1e347b6d84bb913c8492fec (diff)
tools: bpftool: print only one error message on byte parsing failure
Make error messages more consistent. Specifically, when bpftool fails at parsing map key bytes, make it print a single error message to stderr and return from the function, instead of (always) printing a second error message afterwards. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--tools/bpf/bpftool/map.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index b1dad76215ed..e1004d825392 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -252,7 +252,7 @@ static char **parse_bytes(char **argv, const char *name, unsigned char *val,
val[i] = strtoul(argv[i], &endptr, 0);
if (*endptr) {
err("error parsing byte: %s\n", argv[i]);
- break;
+ return NULL;
}
i++;
}