mirror of
https://github.com/libfuse/libfuse.git
synced 2026-07-07 14:47:41 +08:00
fuse_service: Avoid modifying counters in for loop
CodeQL annotates that and I personally prefer while loops for such loops as well. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
This commit is contained in:
@@ -39,20 +39,22 @@ int main(int argc, char *argv[])
|
|||||||
* This doesn't tell us if the listening socket is actually connected
|
* This doesn't tell us if the listening socket is actually connected
|
||||||
* to anything.
|
* to anything.
|
||||||
*/
|
*/
|
||||||
for (i = 1; i < argc; i++) {
|
i = 1;
|
||||||
|
while (i < argc) {
|
||||||
if (!strcmp(argv[i], "--check")) {
|
if (!strcmp(argv[i], "--check")) {
|
||||||
if (check) {
|
if (check) {
|
||||||
check = false;
|
check = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
check = true;
|
check = true;
|
||||||
|
i++;
|
||||||
} else if (!strcmp(argv[i], "-t") && i + 1 < argc) {
|
} else if (!strcmp(argv[i], "-t") && i + 1 < argc) {
|
||||||
if (fstype) {
|
if (fstype) {
|
||||||
check = false;
|
check = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fstype = argv[i + 1];
|
fstype = argv[i + 1];
|
||||||
i++;
|
i += 2;
|
||||||
} else {
|
} else {
|
||||||
check = false;
|
check = false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -493,10 +493,11 @@ static int mount_service_capture_args(struct mount_service *mo, int argc,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
i = 1;
|
||||||
|
while (i < argc) {
|
||||||
/* skip the -t(ype) argument */
|
/* skip the -t(ype) argument */
|
||||||
if (!strcmp(argv[i], "-t") && i + 1 < argc) {
|
if (!strcmp(argv[i], "-t") && i + 1 < argc) {
|
||||||
i++;
|
i += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,6 +505,7 @@ static int mount_service_capture_args(struct mount_service *mo, int argc,
|
|||||||
&array_pos, &string_pos);
|
&array_pos, &string_pos);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now write the header */
|
/* Now write the header */
|
||||||
|
|||||||
Reference in New Issue
Block a user