From 6feb59668308a326ec979b7992613138b986c985 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 25 Nov 2013 09:26:20 +0100 Subject: [PATCH] trafgen: Check return value of system() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 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: trafgen_parser.y:598:9: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Tobias Klauser --- trafgen_parser.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trafgen_parser.y b/trafgen_parser.y index 71f5ddd4..93755e9d 100644 --- a/trafgen_parser.y +++ b/trafgen_parser.y @@ -595,7 +595,8 @@ int compile_packets(char *file, int verbose, int cpu, bool invoke_cpp) 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); -- 2.11.4.GIT