From: Todd C. Miller Date: Thu, 21 Dec 2017 23:31:42 +0000 (-0700) Subject: Stop looking for an editor as soon as we find one. X-Git-Tag: SUDO_1_8_22^2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa2ab63da95cce190e5d371c7e582fc539910789;p=sudo Stop looking for an editor as soon as we find one. A similar fix was made to visudo some time ago. --- diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index 50dcf08f7..7a7265d67 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -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); } }