Open file with O_BINARY on windows.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1772 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aj 2004-04-21 07:33:49 +00:00
parent effbc2a7b6
commit 9fb7334e71
1 changed files with 7 additions and 0 deletions

View File

@ -739,10 +739,17 @@ sign_data(CK_SLOT_ID slot, CK_SESSION_HANDLE session, CK_OBJECT_HANDLE key)
if (rv != CKR_OK)
p11_fatal("C_SignFinal", rv);
#ifdef _WIN32
if (opt_output == NULL)
fd = 1;
else if ((fd = open(opt_output, O_CREAT|O_TRUNC|O_WRONLY, 0666)) < 0)
fatal("failed to open %s: %m", opt_output);
#else
if (opt_output == NULL)
fd = 1;
else if ((fd = open(opt_output, O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, 0666)) < 0)
fatal("failed to open %s: %m", opt_output);
#endif /* _WIN32 */
r = write(fd, buffer, sig_len);
if (r < 0)