use _setmode instead of _set_fmode in windows

now compiles with MinGW-w64
This commit is contained in:
Frank Morgner 2013-07-10 16:32:56 +02:00
parent 9a05414f9a
commit 1a65ed1ecf
1 changed files with 4 additions and 2 deletions

View File

@ -389,7 +389,9 @@ int main(int argc, char * argv[])
CK_RV rv;
#ifdef _WIN32
if (_set_fmode(_O_BINARY) == EINVAL)
if(_setmode(_fileno(stdout), _O_BINARY ) == -1)
util_fatal("Cannot set FMODE to O_BINARY");
if(_setmode(_fileno(stdin), _O_BINARY ) == -1)
util_fatal("Cannot set FMODE to O_BINARY");
#endif
@ -1458,7 +1460,7 @@ static void hash_data(CK_SLOT_ID slot, CK_SESSION_HANDLE session)
if (opt_input == NULL)
fd = 0;
else if ((fd = open(opt_input, O_RDONLY)) < 0)
else if ((fd = open(opt_input, O_RDONLY|O_BINARY)) < 0)
util_fatal("Cannot open %s: %m", opt_input);
while ((r = read(fd, buffer, sizeof(buffer))) > 0) {