- struct pol_rule *loop, *dup;
- char *loop_value, *dup_value;
- int duplicate;
-
- for (loop = config_rules; loop; loop = loop->next) {
- if (loop->type != rule_policy && loop->type != rule_part)
- continue;
- duplicate = 0;
-
- /* only policies with paths and with actions supporting
- * bare disks are considered */
- loop_value = find_rule(loop->rule, pol_act);
- if (!loop_value || map_act(loop_value) < act_spare_same_slot)
- continue;
- loop_value = find_rule(loop->rule, rule_path);
- if (!loop_value)
- continue;
- for (dup = config_rules; dup != loop; dup = dup->next) {
- if (dup->type != rule_policy && loop->type != rule_part)
- continue;
- dup_value = find_rule(dup->rule, pol_act);
- if (!dup_value || map_act(dup_value) < act_spare_same_slot)
- continue;
- dup_value = find_rule(dup->rule, rule_path);
- if (!dup_value)
- continue;
- if (strcmp(loop_value, dup_value) == 0) {
- duplicate = 1;
- break;
- }
- }
-
- /* not a dup or first occurrence */
- if (!duplicate)
- if (!write_rule(loop->rule, fd, loop->type == rule_part) )
- return 0;
- }
- return 1;
+ struct pol_rule *loop, *dup;
+ char *loop_value, *dup_value;
+ int duplicate;
+
+ for (loop = config_rules; loop; loop = loop->next) {
+ if (loop->type != rule_policy && loop->type != rule_part)
+ continue;
+ duplicate = 0;
+
+ /* only policies with paths and with actions supporting
+ * bare disks are considered */
+ loop_value = find_rule(loop->rule, pol_act);
+ if (!loop_value || map_act(loop_value) < act_spare_same_slot)
+ continue;
+ loop_value = find_rule(loop->rule, rule_path);
+ if (!loop_value)
+ continue;
+ for (dup = config_rules; dup != loop; dup = dup->next) {
+ if (dup->type != rule_policy && loop->type != rule_part)
+ continue;
+ dup_value = find_rule(dup->rule, pol_act);
+ if (!dup_value || map_act(dup_value) < act_spare_same_slot)
+ continue;
+ dup_value = find_rule(dup->rule, rule_path);
+ if (!dup_value)
+ continue;
+ if (strcmp(loop_value, dup_value) == 0) {
+ duplicate = 1;
+ break;
+ }
+ }
+
+ /* not a dup or first occurrence */
+ if (!duplicate)
+ if (!write_rule(loop->rule, fd, loop->type == rule_part) )
+ return 0;
+ }
+ return 1;