On 2015-11-10 at 07:29:12 +0100, Vadim Kochan <[email protected]> wrote: > Allow read compiled BPF instructions from stdin by via '-f -' option. > > Signed-off-by: Vadim Kochan <[email protected]> > --- > bpf.c | 6 +++++- > netsniff-ng.8 | 5 +++-- > netsniff-ng.c | 2 +- > 3 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/bpf.c b/bpf.c > index 2d769ec..15d804d 100644 > --- a/bpf.c > +++ b/bpf.c > @@ -720,7 +720,11 @@ void bpf_parse_rules(char *rulefile, struct sock_fprog > *bpf, uint32_t link_type) > return; > } > > - fp = fopen(rulefile, "r"); > + if (!strcmp(rulefile, "-")) > + fp = stdin;
Shouldn't we avoid fclose()ing stdin in this case later on in the function? Otherwise the patch looks good to me. -- You received this message because you are subscribed to the Google Groups "netsniff-ng" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
