lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 1 Mar 2018 20:20:10 -0800 From: Jakub Kicinski <jakub.kicinski@...ronome.com> To: alexei.starovoitov@...il.com, daniel@...earbox.net Cc: netdev@...r.kernel.org, oss-drivers@...ronome.com, Quentin Monnet <quentin.monnet@...ronome.com> Subject: [PATCH bpf-next 3/4] tools: bpftool: read from stdin when batch file name is "-" From: Quentin Monnet <quentin.monnet@...ronome.com> Make bpftool read its command list from standard input when the name if the input file is a single dash. Signed-off-by: Quentin Monnet <quentin.monnet@...ronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@...ronome.com> --- tools/bpf/bpftool/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c index cdee4c3d30c3..1da54a9b5ea3 100644 --- a/tools/bpf/bpftool/main.c +++ b/tools/bpf/bpftool/main.c @@ -195,7 +195,10 @@ static int do_batch(int argc, char **argv) } NEXT_ARG(); - fp = fopen(*argv, "r"); + if (!strcmp(*argv, "-")) + fp = stdin; + else + fp = fopen(*argv, "r"); if (!fp) { p_err("Can't open file (%s): %s", *argv, strerror(errno)); return -1; @@ -284,7 +287,8 @@ static int do_batch(int argc, char **argv) err = 0; } err_close: - fclose(fp); + if (fp != stdin) + fclose(fp); if (json_output) jsonw_end_array(json_wtr); -- 2.15.1
Powered by blists - more mailing lists