]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
tools: bpftool: print only one error message on byte parsing failure
authorQuentin Monnet <quentin.monnet@netronome.com>
Thu, 19 Oct 2017 22:46:23 +0000 (15:46 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Oct 2017 01:11:32 +0000 (02:11 +0100)
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>
tools/bpf/bpftool/map.c

index b1dad76215ed5495449cb15b686de4aca9ff65b1..e1004d8253924bee0f29d7d2362f6a8941168ecf 100644 (file)
@@ -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++;
        }