summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trafgen_parser.y10
1 files changed, 8 insertions, 2 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y
index 035d9c1..cd87c12 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -12,11 +12,12 @@
#include <stdio.h>
#include <stdlib.h>
-#include <signal.h>
#include <stdint.h>
-#include <errno.h>
#include <stdbool.h>
+#include <errno.h>
#include <libgen.h>
+#include <signal.h>
+#include <unistd.h>
#include <net/if_arp.h>
#include <netinet/in.h>
#include <linux/icmp.h>
@@ -1037,6 +1038,11 @@ void compile_packets(char *file, bool verbose, unsigned int cpu,
char tmp_file[128];
int ret = -1;
+ if (access(file, R_OK)) {
+ fprintf(stderr, "Cannot access %s: %s!\n", file, strerror(errno));
+ die();
+ }
+
memset(tmp_file, 0, sizeof(tmp_file));
our_cpu = cpu;