diff options
Diffstat (limited to 'tools/gpgtar.c')
-rw-r--r-- | tools/gpgtar.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/tools/gpgtar.c b/tools/gpgtar.c index 01efacc7d..ace5e5978 100644 --- a/tools/gpgtar.c +++ b/tools/gpgtar.c @@ -511,49 +511,30 @@ main (int argc, char **argv) * status fd is passed verbatim to gpg. */ if (opt.status_fd) { - int fd = -1; + es_syshd_t syshd; -#ifdef HAVE_W32_SYSTEM - gnupg_fd_t hd; - - err = gnupg_sys2libc_fdstr (opt.status_fd, 1, &hd, NULL); - if ((uintptr_t)hd == 1) - fd = 1; - else if ((uintptr_t)hd == 2) - fd = 2; -#else - err = gnupg_sys2libc_fdstr (opt.status_fd, 1, NULL, &fd); -#endif + err = gnupg_parse_fdstr (opt.status_fd, &syshd); if (err) log_fatal ("status-fd is invalid: %s\n", gpg_strerror (err)); - if (fd == 1) + if (syshd.type == ES_SYSHD_FD && syshd.u.fd == 1) { opt.status_stream = es_stdout; if (!skip_crypto) log_fatal ("using stdout for the status-fd is not possible\n"); } - else if (fd == 2) + else if (syshd.type == ES_SYSHD_FD && syshd.u.fd == 2) opt.status_stream = es_stderr; else { - es_syshd_t syshd; - -#ifdef HAVE_W32_SYSTEM - syshd.type = ES_SYSHD_HANDLE; - syshd.u.handle = hd; -#else - syshd.type = ES_SYSHD_FD; - syshd.u.fd = fd; -#endif opt.status_stream = es_sysopen (&syshd, "w"); if (opt.status_stream) es_setvbuf (opt.status_stream, NULL, _IOLBF, 0); } if (!opt.status_stream) { - log_fatal ("can't open fd %d for status output: %s\n", - fd, strerror (errno)); + log_fatal ("can't open fd %s for status output: %s\n", + opt.status_fd, strerror (errno)); } } |