[Pkg-gnupg-commit] [gnupg2] 36/180: gpg: Make --decrypt with output '-&nnnn' work.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Sat Dec 24 22:29:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gnupg2.
commit a5910e00ace882b8a17169faf4607163ab454af9
Author: Werner Koch <wk at gnupg.org>
Date: Tue Nov 29 16:42:14 2016 +0100
gpg: Make --decrypt with output '-&nnnn' work.
* g10/plaintext.c (get_output_file): Check and open special filename
before falling back to stdout.
--
GnuPG-bug-id: 2677
Signed-off-by: Werner Koch <wk at gnupg.org>
---
g10/plaintext.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/g10/plaintext.c b/g10/plaintext.c
index bdf5592..40ce603 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -108,9 +108,25 @@ get_output_file (const byte *embedded_name, int embedded_namelen,
}
else if (iobuf_is_pipe_filename (fname) || !*fname)
{
- /* No filename or "-" given; write to stdout. */
- fp = es_stdout;
- es_set_binary (fp);
+ /* Special file name, no filename, or "-" given; write to the
+ * file descriptor or to stdout. */
+ int fd;
+ char xname[64];
+
+ fd = check_special_filename (fname, 1, 0);
+ if (fd == -1)
+ {
+ /* Not a special filename, thus we want stdout. */
+ fp = es_stdout;
+ es_set_binary (fp);
+ }
+ else if (!(fp = es_fdopen_nc (fd, "wb")))
+ {
+ err = gpg_error_from_syserror ();
+ snprintf (xname, sizeof xname, "[fd %d]", fd);
+ log_error (_("can't open '%s': %s\n"), xname, gpg_strerror (err));
+ goto leave;
+ }
}
else
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list