diff options
author | NIIBE Yutaka <[email protected]> | 2023-07-13 05:23:07 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-07-13 05:23:07 +0000 |
commit | b4246422f4ffa4d65d80eb86923aee9037c7f911 (patch) | |
tree | 70e224ef15284c9ca42f7f741a6d0fe5559b2282 | |
parent | sm: Fix calling of open_stream_nc. (diff) | |
download | gnupg-b4246422f4ffa4d65d80eb86923aee9037c7f911.tar.gz gnupg-b4246422f4ffa4d65d80eb86923aee9037c7f911.zip |
sm: Fix handling of importing in binary mode.
* sm/import.c (gpgsm_import_files): Fix handling of binary mode.
--
GnuPG-bug-id: 6592
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | sm/import.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sm/import.c b/sm/import.c index df5b95c3a..ac0b4f4b5 100644 --- a/sm/import.c +++ b/sm/import.c @@ -524,12 +524,17 @@ gpgsm_import_files (ctrl_t ctrl, int nfiles, char **files, memset (&stats, 0, sizeof stats); if (!nfiles) - rc = import_one (ctrl, &stats, es_stdin); + { +#ifdef HAVE_DOSISH_SYSTEM + setmode (0, O_BINARY); +#endif + rc = import_one (ctrl, &stats, es_stdin); + } else { for (; nfiles && !rc ; nfiles--, files++) { - estream_t fp = of (*files, "r"); + estream_t fp = of (*files, "rb"); rc = import_one (ctrl, &stats, fp); es_fclose (fp); if (rc == -1/* legacy*/ || gpg_err_code (rc) == GPG_ERR_NOT_FOUND) |