From 4783d69e48bb494a6ca2f9cb4356501979198433 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Tue, 27 Dec 2011 18:22:30 -0200 Subject: [PATCH] kmod tool: don't keep iterating when command has been executed --- tools/kmod.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/kmod.c b/tools/kmod.c index ddd12e7..a5cb6da 100644 --- a/tools/kmod.c +++ b/tools/kmod.c @@ -142,19 +142,16 @@ fail: static int handle_kmod_compat_commands(int argc, char *argv[]) { const char *cmd; - int err = -ENOENT; size_t i; cmd = basename(argv[0]); for (i = 0; i < ARRAY_SIZE(kmod_compat_cmds); i++) { - if (strcmp(kmod_compat_cmds[i]->name, cmd) != 0) - continue; - - err = kmod_compat_cmds[i]->cmd(argc, argv); + if (strcmp(kmod_compat_cmds[i]->name, cmd) == 0) + return kmod_compat_cmds[i]->cmd(argc, argv); } - return err; + return -ENOENT; } int main(int argc, char *argv[]) -- 2.7.4