Changeset 3492

Show
Ignore:
Timestamp:
04/25/08 14:49:11 (6 months ago)
Author:
alonbl
Message:

Use O_BINARY at rutoken

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/tools/rutoken-tool.c

    r3478 r3492  
    3737#include "util.h" 
    3838 
     39/* win32 needs this in open(2) */ 
     40#ifndef O_BINARY 
     41#define O_BINARY 0 
     42#endif 
     43 
    3944#define IV_SIZE         8 
    4045#define HASH_SIZE       4 
     
    196201        u8 *inbuf = NULL, *outbuf = NULL, *p; 
    197202 
    198         fd_in = open(path_infile, O_RDONLY); 
     203        fd_in = open(path_infile, O_RDONLY | O_BINARY); 
    199204        if (fd_in < 0) { 
    200205                fprintf(stderr, "Error: Cannot open file '%s'\n", path_infile); 
     
    241246 
    242247        if (err == 0) { 
    243                 fd_out = open(path_outfile, O_WRONLY | O_CREAT | O_TRUNC, 
     248                fd_out = open(path_outfile, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 
    244249                                S_IRUSR | S_IWUSR); 
    245250                if (fd_out < 0) { 
     
    308313        u8 outbuf[HASH_SIZE]; 
    309314 
    310         fd = open(path_infile, O_RDONLY); 
     315        fd = open(path_infile, O_RDONLY | O_BINARY); 
    311316        if (fd < 0) { 
    312317                fprintf(stderr, "Error: Cannot open file '%s'\n", path_infile);