diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2013-11-25 09:26:20 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2013-11-25 09:26:46 +0100 |
commit | 6feb59668308a326ec979b7992613138b986c985 (patch) | |
tree | f7a3cedee0966cf8ce213dcfe0b486698fe42d70 /trafgen_parser.y | |
parent | b9c04d953676c63c9e069a9ada1bb589860b470b (diff) |
trafgen: 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:
trafgen_parser.y:598:9: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r-- | trafgen_parser.y | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y index 71f5ddd..93755e9 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); |