add build deps to enable use of autoreconf in rules
[debian/sudo] / src / tgetpass.c
index f8a9d3e323b284612629f77ad81a3cdb3f8ec87a..e9915b2bdd7af6a7e96341214d9e31387c4747d3 100644 (file)
@@ -61,12 +61,6 @@ static void handler(int);
 static char *getln(int, char *, size_t, int);
 static char *sudo_askpass(const char *, const char *);
 
-#ifdef _PATH_SUDO_ASKPASS
-const char *askpass_path = _PATH_SUDO_ASKPASS;
-#else
-const char *askpass_path;
-#endif
-
 /*
  * Like getpass(3) but with timeout and echo flags.
  */
@@ -86,7 +80,7 @@ tgetpass(const char *prompt, int timeout, int flags)
     if (askpass == NULL) {
        askpass = getenv("SUDO_ASKPASS");
        if (askpass == NULL || *askpass == '\0')
-           askpass = askpass_path;
+           askpass = sudo_conf_askpass_path();
     }
 
     /* If no tty present and we need to disable echo, try askpass. */
@@ -260,6 +254,9 @@ sudo_askpass(const char *askpass, const char *prompt)
     (void) close(pfd[0]);
     (void) sigaction(SIGPIPE, &saved_sa_pipe, NULL);
 
+    if (pass == NULL)
+       errno = EINTR;  /* make cancel button simulate ^C */
+
     debug_return_str_masked(pass);
 }
 
@@ -301,8 +298,7 @@ getln(int fd, char *buf, size_t bufsiz, int feedback)
                }
                continue;
            }
-           if (write(fd, "*", 1) == -1)
-               /* shut up glibc */;
+           ignore_result(write(fd, "*", 1));
        }
        *cp++ = c;
     }