Browse Source

Add O_BINARY to open() calls for MinGW

tags/v1.1
Bernhard Fröhlich 8 months ago
parent
commit
36a3bf5dda
Signed by: Bernhard Froehlich <decke@bluelife.at> GPG Key ID: 4DD88C3F9F3B8333
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      drmdecrypt.c

+ 4
- 2
drmdecrypt.c View File

@@ -26,6 +26,8 @@
26 26
 #if defined(_WIN32) || defined(_WIN64)
27 27
 #define S_IRGRP (S_IRUSR >> 3)
28 28
 #define S_IROTH (S_IRGRP >> 3)
29
+#else
30
+#define O_BINARY 0
29 31
 #endif
30 32
 
31 33
 /* Helper macros */
@@ -334,14 +336,14 @@ int decryptsrf(char *srffile, char *inkeyfile, char *outdir)
334 336
 
335 337
    pbinit(&pb);
336 338
 
337
-   pb.fdwrite = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
339
+   pb.fdwrite = open(outfile, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
338 340
    if(pb.fdwrite == -1)
339 341
    {
340 342
       trace(TRC_ERROR, "Cannot open %s for writing", outfile);
341 343
       return 1;
342 344
    }
343 345
 
344
-   pb.fdread = open(srffile, O_RDONLY);
346
+   pb.fdread = open(srffile, O_RDONLY | O_BINARY);
345 347
    if(pb.fdread == -1)
346 348
    {
347 349
       trace(TRC_ERROR, "Cannot open %s for reading", srffile);

Loading…
Cancel
Save