diff options
author | Colin Watson <cjwatson@debian.org> | 2005-09-14 12:45:47 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2005-09-14 12:45:47 +0000 |
commit | 9b71add4cecf753c45f5fbd6ff0913bc95b3e95d (patch) | |
tree | d4ea8fdb30c7949c6433f5277c39548ea579d4dc /readpass.c | |
parent | ed07bcbea56007ab5b218ddf3aa6a7d4e21966e0 (diff) | |
parent | 16704d57999d987fb8d9ba53379841a79f016d67 (diff) |
Merge 4.2p1 to the trunk.
Diffstat (limited to 'readpass.c')
-rw-r--r-- | readpass.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/readpass.c b/readpass.c index c2bacdcd4..7914799a4 100644 --- a/readpass.c +++ b/readpass.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: readpass.c,v 1.31 2004/10/29 22:53:56 djm Exp $"); | 26 | RCSID("$OpenBSD: readpass.c,v 1.33 2005/05/02 21:13:22 markus Exp $"); |
27 | 27 | ||
28 | #include "xmalloc.h" | 28 | #include "xmalloc.h" |
29 | #include "misc.h" | 29 | #include "misc.h" |
@@ -106,15 +106,20 @@ read_passphrase(const char *prompt, int flags) | |||
106 | if (flags & RP_USE_ASKPASS) | 106 | if (flags & RP_USE_ASKPASS) |
107 | use_askpass = 1; | 107 | use_askpass = 1; |
108 | else if (flags & RP_ALLOW_STDIN) { | 108 | else if (flags & RP_ALLOW_STDIN) { |
109 | if (!isatty(STDIN_FILENO)) | 109 | if (!isatty(STDIN_FILENO)) { |
110 | debug("read_passphrase: stdin is not a tty"); | ||
110 | use_askpass = 1; | 111 | use_askpass = 1; |
112 | } | ||
111 | } else { | 113 | } else { |
112 | rppflags |= RPP_REQUIRE_TTY; | 114 | rppflags |= RPP_REQUIRE_TTY; |
113 | ttyfd = open(_PATH_TTY, O_RDWR); | 115 | ttyfd = open(_PATH_TTY, O_RDWR); |
114 | if (ttyfd >= 0) | 116 | if (ttyfd >= 0) |
115 | close(ttyfd); | 117 | close(ttyfd); |
116 | else | 118 | else { |
119 | debug("read_passphrase: can't open %s: %s", _PATH_TTY, | ||
120 | strerror(errno)); | ||
117 | use_askpass = 1; | 121 | use_askpass = 1; |
122 | } | ||
118 | } | 123 | } |
119 | 124 | ||
120 | if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL) | 125 | if ((flags & RP_USE_ASKPASS) && getenv("DISPLAY") == NULL) |