summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpf_parser.y4
-rw-r--r--trafgen_parser.y3
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);