|
|
46e910 |
From 531f40824a76754962285f1996894e9e6db2f410 Mon Sep 17 00:00:00 2001
|
|
|
46e910 |
From: Laine Stump <laine@laine.org>
|
|
|
46e910 |
Date: Mon, 17 Sep 2018 10:05:15 -0400
|
|
|
46e910 |
Subject: [PATCH 3/7] Make the empty body of for loops more obvious
|
|
|
46e910 |
|
|
|
46e910 |
parseline() was skipping over non-option commandline args with 3 for
|
|
|
46e910 |
loops that had empty bodies signified by semicolons at the end of the
|
|
|
46e910 |
for() line (twice) or with a body comprised completely of a nested
|
|
|
46e910 |
for() that had an empty body. Coverity didn't like this. Put braces
|
|
|
46e910 |
around all three loop bodies to make the intent more clear.
|
|
|
46e910 |
|
|
|
46e910 |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
|
46e910 |
(cherry picked from commit ef9971b64d8224d1626177978227c7009812f275)
|
|
|
46e910 |
|
|
|
46e910 |
Resolves: https://bugzilla.redhat.com/1602628
|
|
|
46e910 |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
|
46e910 |
---
|
|
|
46e910 |
src/ncftool.c | 9 ++++++---
|
|
|
46e910 |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
46e910 |
|
|
|
46e910 |
diff --git a/src/ncftool.c b/src/ncftool.c
|
|
|
46e910 |
index 7a1db5b..7baf06a 100644
|
|
|
46e910 |
--- a/src/ncftool.c
|
|
|
46e910 |
+++ b/src/ncftool.c
|
|
|
46e910 |
@@ -653,9 +653,12 @@ static int parseline(struct command *cmd, char *line) {
|
|
|
46e910 |
}
|
|
|
46e910 |
for (def = cmd->def->opts;
|
|
|
46e910 |
def->name != NULL && !opt_def_is_arg(def);
|
|
|
46e910 |
- def++);
|
|
|
46e910 |
- for (int i=0; i < curarg; i++)
|
|
|
46e910 |
- for (; def->name != NULL && !opt_def_is_arg(def); def++);
|
|
|
46e910 |
+ def++) {
|
|
|
46e910 |
+ }
|
|
|
46e910 |
+ for (int i=0; i < curarg; i++) {
|
|
|
46e910 |
+ for (; def->name != NULL && !opt_def_is_arg(def); def++) {
|
|
|
46e910 |
+ }
|
|
|
46e910 |
+ }
|
|
|
46e910 |
struct command_opt *opt =
|
|
|
46e910 |
make_command_opt(cmd, def);
|
|
|
46e910 |
opt->string = tok;
|
|
|
46e910 |
--
|
|
|
46e910 |
2.18.1
|
|
|
46e910 |
|