From b9c04d953676c63c9e069a9ada1bb589860b470b Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 25 Nov 2013 09:24:05 +0100 Subject: bpfc: Check return value of system() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- bpf_parser.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bpf_parser.y') 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); -- cgit v1.2.3-54-g00ecf