diff options
Diffstat (limited to 'tools/bpf/bpftool/gen.c')
| -rw-r--r-- | tools/bpf/bpftool/gen.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c index f8113b3646f5..10de76b296ba 100644 --- a/tools/bpf/bpftool/gen.c +++ b/tools/bpf/bpftool/gen.c @@ -17,7 +17,6 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> -#include <unistd.h> #include <bpf/btf.h> #include "bpf/libbpf_internal.h" @@ -201,7 +200,7 @@ out: return err; } -static int codegen(const char *template, ...) +static void codegen(const char *template, ...) { const char *src, *end; int skip_tabs = 0, n; @@ -212,7 +211,7 @@ static int codegen(const char *template, ...) n = strlen(template); s = malloc(n + 1); if (!s) - return -ENOMEM; + exit(-1); src = template; dst = s; @@ -225,7 +224,8 @@ static int codegen(const char *template, ...) } else { p_err("unrecognized character at pos %td in template '%s'", src - template - 1, template); - return -EINVAL; + free(s); + exit(-1); } } @@ -235,7 +235,8 @@ static int codegen(const char *template, ...) if (*src != '\t') { p_err("not enough tabs at pos %td in template '%s'", src - template - 1, template); - return -EINVAL; + free(s); + exit(-1); } } /* trim trailing whitespace */ @@ -256,7 +257,6 @@ static int codegen(const char *template, ...) va_end(args); free(s); - return n; } static int do_skeleton(int argc, char **argv) @@ -587,12 +587,12 @@ static int do_help(int argc, char **argv) } fprintf(stderr, - "Usage: %1$s gen skeleton FILE\n" - " %1$s gen help\n" + "Usage: %1$s %2$s skeleton FILE\n" + " %1$s %2$s help\n" "\n" " " HELP_SPEC_OPTIONS "\n" "", - bin_name); + bin_name, "gen"); return 0; } |
