summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-11-25 09:24:05 +0100
committerTobias Klauser <tklauser@distanz.ch>2013-11-25 09:24:05 +0100
commitb9c04d953676c63c9e069a9ada1bb589860b470b (patch)
treeb0f1034a5fa6635e01e836dca137e8418f9d47b7
parent8dcdd694e879451d7b68e45587772757f8d7da87 (diff)
bpfc: Check return value of system()
Check the return value of system() when invoking CPP in the BPF parser and bail out in case of an error. This fixes the following compiler warning: bpf_parser.y:754:9: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--bpf_parser.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/bpf_parser.y b/bpf_parser.y
index c8d2a8f..0cf2a75 100644
--- a/bpf_parser.y
+++ b/bpf_parser.y
@@ -751,7 +751,8 @@ int compile_filter(char *file, int verbose, int bypass, int format,
slprintf(tmp_file, sizeof(tmp_file), "%s/.tmp-%u-%s", dir, rand(), base);
slprintf(cmd, sizeof(cmd), "cpp -I" PREFIX_STRING
"/etc/netsniff-ng/ %s > %s", file, tmp_file);
- system(cmd);
+ if (system(cmd) != 0)
+ panic("Failed to invoke C preprocessor!\n");
file = tmp_file;
xfree(a);