tc: m_xt: Fix indenting

By exiting early if xtables_find_target() fails, one indenting level can
be dropped. Some of the wrongly indented code then happens to sit at the
right spot by accident which is why this patch is smaller than expected.

Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
Phil Sutter 2016-06-10 13:42:02 +02:00 committed by Stephen Hemminger
parent 8eee75a835
commit f1a7c7d830

View File

@ -161,7 +161,10 @@ static int parse_ipt(struct action_util *a, int *argc_p,
switch (c) { switch (c) {
case 'j': case 'j':
m = xtables_find_target(optarg, XTF_TRY_LOAD); m = xtables_find_target(optarg, XTF_TRY_LOAD);
if (m != NULL) { if (!m) {
fprintf(stderr, " failed to find target %s\n\n", optarg);
return -1;
}
if (build_st(m, NULL) < 0) { if (build_st(m, NULL) < 0) {
printf(" %s error\n", m->name); printf(" %s error\n", m->name);
@ -182,10 +185,6 @@ static int parse_ipt(struct action_util *a, int *argc_p,
return -1; return -1;
} else } else
tmp_tcipt_globals.opts = opts; tmp_tcipt_globals.opts = opts;
} else {
fprintf(stderr, " failed to find target %s\n\n", optarg);
return -1;
}
ok++; ok++;
break; break;
@ -196,8 +195,8 @@ static int parse_ipt(struct action_util *a, int *argc_p,
xtables_option_tpcall(c, argv, 0, m, NULL); xtables_option_tpcall(c, argv, 0, m, NULL);
#else #else
if (m != NULL && m->parse != NULL) { if (m != NULL && m->parse != NULL) {
m->parse(c - m->option_offset, argv, 0, &m->tflags, m->parse(c - m->option_offset, argv, 0,
NULL, &m->t); &m->tflags, NULL, &m->t);
#endif #endif
} else { } else {
fprintf(stderr, "failed to find target %s\n\n", optarg); fprintf(stderr, "failed to find target %s\n\n", optarg);
@ -339,7 +338,11 @@ print_ipt(struct action_util *au, FILE * f, struct rtattr *arg)
t = RTA_DATA(tb[TCA_IPT_TARG]); t = RTA_DATA(tb[TCA_IPT_TARG]);
m = xtables_find_target(t->u.user.name, XTF_TRY_LOAD); m = xtables_find_target(t->u.user.name, XTF_TRY_LOAD);
if (m != NULL) { if (!m) {
fprintf(stderr, " failed to find target %s\n\n",
t->u.user.name);
return -1;
}
if (build_st(m, t) < 0) { if (build_st(m, t) < 0) {
fprintf(stderr, " %s error\n", m->name); fprintf(stderr, " %s error\n", m->name);
return -1; return -1;
@ -360,11 +363,6 @@ print_ipt(struct action_util *au, FILE * f, struct rtattr *arg)
return -1; return -1;
} else } else
tmp_tcipt_globals.opts = opts; tmp_tcipt_globals.opts = opts;
} else {
fprintf(stderr, " failed to find target %s\n\n",
t->u.user.name);
return -1;
}
fprintf(f, "\ttarget "); fprintf(f, "\ttarget ");
m->print(NULL, m->t, 0); m->print(NULL, m->t, 0);
if (tb[TCA_IPT_INDEX] == NULL) { if (tb[TCA_IPT_INDEX] == NULL) {