From: Bernard Iremonger Date: Wed, 1 Nov 2017 12:10:29 +0000 (+0000) Subject: examples/flow_classify: fix fseek error handling X-Git-Tag: spdx-start~930 X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=c044ffaa37fb77de36b26188ba6e8f63ce00cc7c examples/flow_classify: fix fseek error handling Check return value of fseek and exit if non zero. Coverity issue: 143435 Fixes: bab16ddaf2c1 ("examples/flow_classify: add sample application") Signed-off-by: Bernard Iremonger Acked-by: Jasvinder Singh --- diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index e4cabdb254..766f1dd0e1 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -657,13 +657,17 @@ add_rules(const char *rule_path, struct flow_classifier *cls_app) unsigned int i = 0; unsigned int total_num = 0; struct rte_eth_ntuple_filter ntuple_filter; + int ret; fh = fopen(rule_path, "rb"); if (fh == NULL) - rte_exit(EXIT_FAILURE, "%s: Open %s failed\n", __func__, + rte_exit(EXIT_FAILURE, "%s: fopen %s failed\n", __func__, rule_path); - fseek(fh, 0, SEEK_SET); + ret = fseek(fh, 0, SEEK_SET); + if (ret) + rte_exit(EXIT_FAILURE, "%s: fseek %d failed\n", __func__, + ret); i = 0; while (fgets(buff, LINE_MAX, fh) != NULL) {