]> granicus.if.org Git - sudo/commitdiff
Prefer VISUAL over EDITOR like old vipw did.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 20 Jan 2004 19:18:44 +0000 (19:18 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 20 Jan 2004 19:18:44 +0000 (19:18 +0000)
visudo.c
visudo.pod

index ed2f60a8a52d8d4f66b875334e6e20bafdbbeb6a..cf3dfdba6072fec9536f4d251114025f90024499 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -246,13 +246,13 @@ main(argc, argv)
        (void) close(stmp_fd);
 
     /*
-     * Check EDITOR and VISUAL environment variables to see which editor
+     * Check VISUAL and EDITOR environment variables to see which editor
      * the user wants to use (we may not end up using it though).
      * If the path is not fully-qualified, make it so and check that
      * the specified executable actually exists.
      */
-    if ((UserEditor = getenv("EDITOR")) == NULL || *UserEditor == '\0')
-       UserEditor = getenv("VISUAL");
+    if ((UserEditor = getenv("VISUAL")) == NULL || *UserEditor == '\0')
+       UserEditor = getenv("EDITOR");
     if (UserEditor && *UserEditor == '\0')
        UserEditor = NULL;
     else if (UserEditor) {
index 9f84d3861d9e492e74d4a5117a305b32e6964157..c6c06c33e37e58838f23dccbd47c8bf0678f2f6e 100644 (file)
@@ -59,13 +59,13 @@ There is a hard-coded list of editors that B<visudo> will use set
 at compile-time that may be overridden via the I<editor> I<sudoers>
 C<Default> variable.  This list defaults to the path to vi(1) on
 your system, as determined by the I<configure> script.  Normally,
-B<visudo> does not honor the C<EDITOR> or C<VISUAL> environment
+B<visudo> does not honor the C<VISUAL> or C<EDITOR> environment
 variables unless they contain an editor in the aforementioned editors
 list.  However, if B<visudo> is configured with the I<--with-enveditor>
 flag or the I<enveditor> C<Default> variable is set in I<sudoers>,
-B<visudo> will use any the editor defines by C<EDITOR> or C<VISUAL>.
+B<visudo> will use any the editor defines by C<VISUAL> or C<EDITOR>.
 Note that this can be a security hole since it allows the user to
-execute any program they wish simply by setting C<EDITOR> or C<VISUAL>.
+execute any program they wish simply by setting C<VISUAL> or C<EDITOR>.
 
 B<visudo> parses the I<sudoers> file after the edit and will
 not save the changes if there is a syntax error.  Upon finding
@@ -156,8 +156,8 @@ mode these are errors, not warnings.
 The following environment variables are used only if B<visudo>
 was configured with the I<--with-env-editor> option:
 
EDITOR                        Invoked by visudo as the editor to use
VISUAL                        Used by visudo if EDITOR is not set
VISUAL                        Invoked by visudo as the editor to use
EDITOR                        Used by visudo if VISUAL is not set
 
 =head1 FILES