pkcs11-tool: #407: on Windows use O_BINARY open file mode

https://www.opensc-project.org/opensc/ticket/407
http://msdn.microsoft.com/en-us/library/ee2849wt%28v=VS.71%29.aspx
This commit is contained in:
Viktor Tarasov 2012-08-15 23:06:58 +02:00
parent dfbc3996bf
commit 7e42c6d97d
1 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#ifdef ENABLE_OPENSSL
#include <openssl/opensslv.h>
@ -374,6 +375,11 @@ int main(int argc, char * argv[])
int action_count = 0;
CK_RV rv;
#ifdef _WIN32
if (_set_fmode(_O_BINARY) == EINVAL)
util_fatal("Cannot set FMODE to O_BINARY");
#endif
#ifdef ENABLE_OPENSSL
#if OPENSSL_VERSION_NUMBER >= 0x00907000L
OPENSSL_config(NULL);