]> granicus.if.org Git - sudo/commitdiff
Stop looking for an editor as soon as we find one.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 21 Dec 2017 23:31:42 +0000 (16:31 -0700)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 21 Dec 2017 23:31:42 +0000 (16:31 -0700)
A similar fix was made to visudo some time ago.

plugins/sudoers/sudoers.c

index 50dcf08f7eea7fd8be5ae1a9d7e9606b14fbf185..7a7265d67f948729038463b71a9465139a9a891d 100644 (file)
@@ -1290,7 +1290,9 @@ find_editor(int nfiles, char **files, int *argc_out, char ***argv_out)
            cp != NULL; cp = sudo_strsplit(NULL, def_editor_end, ":", &ep)) {
            editor_path = resolve_editor(cp, (size_t)(ep - cp), nfiles,
                files, argc_out, argv_out, NULL);
-           if (editor_path == NULL && errno != ENOENT)
+           if (editor_path != NULL)
+               break;
+           if (errno != ENOENT)
                debug_return_str(NULL);
        }
     }