Adjust the loop to follow the in-documentation example.
Namely, we don't need the unused idx and removing the seemingly
infinite loop helps static analysers better reason about the code flow.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/195
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
int verbose = LOG_ERR;
int use_syslog = 0;
int flags = 0;
- int i, r = 0;
+ int i, c, r = 0;
- for (;;) {
- int c, idx = 0;
- c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
- if (c == -1)
- break;
+ while ((c = getopt_long(argc, argv, cmdopts_s, cmdopts, NULL)) != -1) {
switch (c) {
case 'f':
flags |= KMOD_REMOVE_FORCE;