librazor/rpm.c
changeset 345 edd9b0fa63ca
parent 339 159067260aad
child 347 7538f8dc4425
     1.1 --- a/librazor/rpm.c	Fri Jan 09 12:32:57 2009 +0000
     1.2 +++ b/librazor/rpm.c	Mon Jan 12 17:54:13 2009 +0000
     1.3 @@ -44,6 +44,10 @@
     1.4  #include "razor.h"
     1.5  #include "razor-internal.h"
     1.6  
     1.7 +#ifndef O_BINARY
     1.8 +#define O_BINARY	0
     1.9 +#endif
    1.10 +
    1.11  #define	RPM_LEAD_SIZE 96
    1.12  
    1.13  enum {
    1.14 @@ -509,7 +513,8 @@
    1.15  	switch (mode >> 12) {
    1.16  	case REG:
    1.17  		/* FIXME: handle the case where a file is already there. */
    1.18 -		fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC, mode & 0x1ff);
    1.19 +		fd = open(buffer, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
    1.20 +			  mode & 0x1ff);
    1.21  		if (fd < 0){
    1.22  			fprintf(stderr, "failed to create file %s\n", buffer);
    1.23  			return -1;