mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-09-03 12:11:34 +00:00
Compare string by strncmp
This commit is contained in:
+3
-1
@@ -45,7 +45,9 @@ int hyper_setup_iptables_rule(struct ipt_rule rule)
|
||||
|
||||
if (check == 0) {
|
||||
// iptables rule already exist, do not insert it again
|
||||
if (rule.op == "-A" || rule.op == "-I" || rule.op == "-N") {
|
||||
if (!strncmp(rule.op, "-A", strlen("-A")) ||
|
||||
!strncmp(rule.op, "-I", strlen("-I")) ||
|
||||
!strncmp(rule.op, "-N", strlen("-N"))) {
|
||||
fprintf(stdout, "iptables rule '%s' already exist\n", rule.rule);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user