From: Quentin Monnet Date: Thu, 19 Oct 2017 22:46:23 +0000 (-0700) Subject: tools: bpftool: print only one error message on byte parsing failure X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=d9c0b48db9f4b870535b6d7255638347e770633f;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Jakub Kicinski Acked-by: Daniel Borkmann Signed-off-by: David S. Miller --- 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++; }