1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

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 <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-07-13 14:23:07 +09:00
parent 635a7fef4d
commit b4246422f4
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -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)