]> granicus.if.org Git - sudo/commitdiff
Add a missing check for UserEditor == NULL
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 4 Jun 2000 23:51:05 +0000 (23:51 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sun, 4 Jun 2000 23:51:05 +0000 (23:51 +0000)
Add missing '+' before line number when invoking editor to fix a syntax error

visudo.c

index a70fdcd3cc017be9185de363a72fbd8a8fba173c..2b2bc2f06bb0c0e7c36d1091677e5ca5982342a4 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -237,7 +237,7 @@ main(argc, argv)
      */
     if ((UserEditor = getenv("EDITOR")) == NULL || *UserEditor == '\0')
        UserEditor = getenv("VISUAL");
-    if (*UserEditor == '\0')
+    if (UserEditor && *UserEditor == '\0')
        UserEditor = NULL;
     else if (UserEditor) {
        if (find_path(UserEditor, &Editor) == FOUND) {
@@ -337,7 +337,7 @@ main(argc, argv)
            av[0] = Editor;
        n = 1;
        if (parse_error == TRUE) {
-           (void) snprintf(linestr, sizeof(linestr), "%d", errorlineno);
+           (void) snprintf(linestr, sizeof(linestr), "+%d", errorlineno);
            av[n++] = linestr;
        }
        av[n++] = stmp;