mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
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@gnupg.org>
This commit is contained in:
parent
60b4982836
commit
a5910e00ac
@ -108,9 +108,25 @@ get_output_file (const byte *embedded_name, int embedded_namelen,
|
|||||||
}
|
}
|
||||||
else if (iobuf_is_pipe_filename (fname) || !*fname)
|
else if (iobuf_is_pipe_filename (fname) || !*fname)
|
||||||
{
|
{
|
||||||
/* No filename or "-" given; write to stdout. */
|
/* Special file name, no filename, or "-" given; write to the
|
||||||
fp = es_stdout;
|
* file descriptor or to stdout. */
|
||||||
es_set_binary (fp);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user