aboutsummaryrefslogtreecommitdiffstats
path: root/g10/passphrase.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2003-08-29 00:14:42 +0000
committerDavid Shaw <[email protected]>2003-08-29 00:14:42 +0000
commit17e67cd29b94821892464537873a88bb6959c937 (patch)
tree3ef1b99467f10988fbf6cf1ec6fb77c32d607bff /g10/passphrase.c
parent* idea-stub.c, random.c; s/__MINGW32__/_WIN32/ to help building on native (diff)
downloadgnupg-17e67cd29b94821892464537873a88bb6959c937.tar.gz
gnupg-17e67cd29b94821892464537873a88bb6959c937.zip
* passphrase.c (agent_send_all_options): Make use of $GPG_TTY.
* g10.c (main): Disable use-agent if passphrase-fd is given later. Suggested by Kurt Garloff. * exec.c, g10.c, gpgv.c, passphrase.c, photoid.c: s/__MINGW32__/_WIN32/ to help building on native Windows compilers. Requested by Brian Gladman. From Werner on stable branch.
Diffstat (limited to '')
-rw-r--r--g10/passphrase.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c
index 769276221..a48f220a2 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -29,7 +29,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#endif
-#if defined (__MINGW32__) || defined (__CYGWIN32__)
+#if defined (_WIN32) || defined (__CYGWIN32__)
# include <windows.h>
#endif
#include <errno.h>
@@ -100,7 +100,7 @@ static char *fd_passwd = NULL;
static char *next_pw = NULL;
static char *last_pw = NULL;
-#if defined (__MINGW32__)
+#if defined (_WIN32)
static int read_fd = 0;
static int write_fd = 0;
#endif
@@ -190,7 +190,7 @@ read_passphrase_from_fd( int fd )
static int
writen ( int fd, const void *buf, size_t nbytes )
{
-#if defined (__MINGW32__)
+#if defined (_WIN32)
DWORD nwritten, nleft = nbytes;
while (nleft > 0) {
@@ -233,7 +233,7 @@ writen ( int fd, const void *buf, size_t nbytes )
static int
readn ( int fd, void *buf, size_t buflen, size_t *ret_nread )
{
-#if defined (__MINGW32__)
+#if defined (_WIN32)
DWORD nread, nleft = buflen;
while (nleft > 0) {
@@ -327,7 +327,7 @@ readline (int fd, char *buf, size_t buflen)
#if !defined (__riscos__)
-#if !defined (__MINGW32__)
+#if !defined (_WIN32)
/* For the new Assuan protocol we may have to send options */
static int
agent_send_option (int fd, const char *name, const char *value)
@@ -375,7 +375,11 @@ agent_send_all_options (int fd)
}
if (!opt.ttyname)
- dft_ttyname = tty_get_ttyname ();
+ {
+ dft_ttyname = getenv ("GPG_TTY");
+ if ((!dft_ttyname || !*dft_ttyname) && tty_get_ttyname ())
+ dft_ttyname = tty_get_ttyname ();
+ }
if (opt.ttyname || dft_ttyname)
{
if (agent_send_option (fd, "ttyname",
@@ -432,7 +436,7 @@ agent_send_all_options (int fd)
#endif
return rc;
}
-#endif /*!__MINGW32__*/
+#endif /*!_WIN32*/
/*
@@ -443,7 +447,7 @@ agent_send_all_options (int fd)
static int
agent_open (int *ret_prot)
{
-#if defined (__MINGW32__)
+#if defined (_WIN32)
int fd;
char *infostr, *p;
HANDLE h;
@@ -588,7 +592,7 @@ agent_open (int *ret_prot)
static void
agent_close ( int fd )
{
-#if defined (__MINGW32__)
+#if defined (_WIN32)
HANDLE h = OpenEvent(EVENT_ALL_ACCESS, FALSE, "gpg_agent");
ResetEvent(h);
#else