diff options
| author | Werner Koch <[email protected]> | 2026-10-01 12:08:25 +0200 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2026-10-01 12:10:29 +0200 |
| commit | 31339d07be50afc8bb9f9756aa1fb2e2417222b4 (patch) | |
| tree | 2a345fa11bfae60cd54cea747c81d85f24eacfa4 | |
| parent | agent,dirmngr,g13,kbx,scd,gpgsm,tools: Fix help/usage strings. (diff) | |
| download | gnupg-31339d07be50afc8bb9f9756aa1fb2e2417222b4.tar.gz gnupg-31339d07be50afc8bb9f9756aa1fb2e2417222b4.zip | |
gpg,sm: Do not use the partial fileguard for /dev/null.
* g10/plaintext.c (get_output_file): Take care of /dev/null et al.
* sm/gpgsm.c (main): Ditto. Also fix regression if
no-partial-file-guard is used
--
We consider all files below /dev/ as special and don't use the part
thing.
The regresion was that with no-partial-file-guard the output would be
send to stdout.
GnuPG-bug-id: 7873
| -rw-r--r-- | g10/plaintext.c | 4 | ||||
| -rw-r--r-- | sm/gpgsm.c | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/g10/plaintext.c b/g10/plaintext.c index d348337bf..69fcc7a5f 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -162,7 +162,9 @@ get_output_file (const byte *embedded_name, int embedded_namelen, if ((opt.compat_flags & COMPAT_NO_PARTIALFILEGUARD) /* Don't enable the partial file guard if it's already prepared. */ - || has_suffix (fname, EXTSEP_S "part")) + || has_suffix (fname, EXTSEP_S "part") + /* or if it is device file like /dev/null */ + || !strncmp (fname, "/dev/", 5)) filename = fname; else { diff --git a/sm/gpgsm.c b/sm/gpgsm.c index c4442f5da..18a898a50 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -2094,11 +2094,18 @@ main ( int argc, char **argv) estream_t fp = NULL; int errcount = log_get_errorcount (0); - if (!(opt.compat_flags & COMPAT_NO_PARTIALFILEGUARD) - && opt.outfile && strcmp (opt.outfile, "-") != 0) + if (opt.outfile && strcmp (opt.outfile, "-")) { - output_filename = xstrconcat (opt.outfile, ".part", NULL); - fp = open_es_fwrite (output_filename); + /* Don't do the part thing for "/dev/null" et al or if the + * compat flag is enabled. */ + if ((opt.compat_flags & COMPAT_NO_PARTIALFILEGUARD) + || !strncmp (opt.outfile, "/dev/", 5)) + fp = open_es_fwrite (opt.outfile); + else + { + output_filename = xstrconcat (opt.outfile, ".part", NULL); + fp = open_es_fwrite (output_filename); + } } else fp = open_es_fwrite ("-"); |
