Do not perform fclose for stdin fd.

Signed-off-by: Vadim Kochan <[email protected]>
---
 bpf_parser.y     | 4 +++-
 trafgen_parser.y | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/bpf_parser.y b/bpf_parser.y
index 26ec125..0959f3d 100644
--- a/bpf_parser.y
+++ b/bpf_parser.y
@@ -812,7 +812,9 @@ int compile_filter(char *file, int verbose, int bypass, int 
format,
                free(labels_k[i]);
        }
 
-       fclose(yyin);
+       if (yyin != stdin)
+               fclose(yyin);
+
        if (invoke_cpp)
                unlink(tmp_file);
 
diff --git a/trafgen_parser.y b/trafgen_parser.y
index 21c3454..a05b7e8 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -635,7 +635,8 @@ void compile_packets(char *file, bool verbose, unsigned int 
cpu, bool invoke_cpp
 
        ret = 0;
 err:
-       fclose(yyin);
+       if (yyin != stdin)
+               fclose(yyin);
 
        if (invoke_cpp)
                unlink(tmp_file);
-- 
2.6.2

-- 
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.

Reply via email to