Changeset 3491

Show
Ignore:
Timestamp:
04/25/08 13:51:03 (6 months ago)
Author:
alonbl
Message:

Cleanup some Windows issues with open

Files:
1 modified

Legend:

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

    r3439 r3491  
    959959                p11_fatal("C_SignFinal", rv); 
    960960 
    961 #ifdef _WIN32 
    962961        if (opt_output == NULL) 
    963962                fd = 1; 
    964         else if ((fd = open(opt_output, O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, 0666)) < 0) 
     963        else if ((fd = open(opt_output, O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, S_IRUSR|S_IWUSR)) < 0) { 
    965964                util_fatal("failed to open %s: %m", opt_output); 
    966 #else 
    967         if (opt_output == NULL) 
    968                 fd = 1; 
    969         else if ((fd = open(opt_output, O_CREAT|O_TRUNC|O_WRONLY, 0666)) < 0) 
    970                 util_fatal("failed to open %s: %m", opt_output); 
    971 #endif /* _WIN32 */ 
     965        } 
    972966 
    973967        r = write(fd, buffer, sig_len); 
     
    10201014        if (opt_output == NULL) 
    10211015                fd = 1; 
    1022         else if ((fd = open(opt_output, O_CREAT|O_TRUNC|O_WRONLY, 0666)) < 0) 
     1016        else if ((fd = open(opt_output, O_CREAT|O_TRUNC|O_WRONLY|O_BINARY, S_IRUSR|S_IWUSR)) < 0) 
    10231017                util_fatal("failed to open %s: %m", opt_output); 
    10241018