Fix a coverity for unchecking return value 22/188722/1
authorhyunuktak <hyunuk.tak@samsung.com>
Mon, 10 Sep 2018 00:11:37 +0000 (09:11 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Mon, 10 Sep 2018 00:11:40 +0000 (09:11 +0900)
Change-Id: I5c9290ebeceb806ab1ff64ed6f0127ce09c81873
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
src/helper/helper-nfacct-rule.c

index d75c3f3..a3e4647 100644 (file)
@@ -476,14 +476,22 @@ static stc_error_e exec_iptables_cmd(nfacct_rule_s *rule)
        iptables_rule.d_iprange_type = rule->dst_iprange_type;
 
        /* specify source and destination ip address if any */
-       if (rule->src_ip1)
-               inet_aton(rule->src_ip1, &iptables_rule.s_ip1);
-       if (rule->src_ip2)
-               inet_aton(rule->src_ip2, &iptables_rule.s_ip2);
-       if (rule->dst_ip1)
-               inet_aton(rule->dst_ip1, &iptables_rule.d_ip1);
-       if (rule->dst_ip2)
-               inet_aton(rule->dst_ip2, &iptables_rule.d_ip2);
+       if (rule->src_ip1) {
+               if (!inet_aton(rule->src_ip1, &iptables_rule.s_ip1))
+                       STC_LOGE("Failed to inet aton [%s]", rule->src_ip1);
+       }
+       if (rule->src_ip2) {
+               if (!inet_aton(rule->src_ip2, &iptables_rule.s_ip2))
+                       STC_LOGE("Failed to inet aton [%s]", rule->src_ip2);
+       }
+       if (rule->dst_ip1) {
+               if (!inet_aton(rule->dst_ip1, &iptables_rule.d_ip1))
+                       STC_LOGE("Failed to inet aton [%s]", rule->dst_ip1);
+       }
+       if (rule->dst_ip2) {
+               if (!inet_aton(rule->dst_ip2, &iptables_rule.d_ip2))
+                       STC_LOGE("Failed to inet aton [%s]", rule->dst_ip2);
+       }
 
        if (rule->action == NFACCT_ACTION_DELETE) {
                /* delete interface rule */