From 726feff722dbaee93064ffc603d9979c26399928 Mon Sep 17 00:00:00 2001 From: Gillen Daniel Date: Thu, 27 Jun 2013 23:08:15 +0200 Subject: [PATCH] hivex: Add O_BINARY flag to open calls for platforms where this isn't the default (such as Win32) --- lib/hivex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/hivex.c b/lib/hivex.c index 040b1e7..86e5959 100644 --- a/lib/hivex.c +++ b/lib/hivex.c @@ -265,9 +265,9 @@ hivex_open (const char *filename, int flags) goto error; #ifdef O_CLOEXEC - h->fd = open (filename, O_RDONLY | O_CLOEXEC); + h->fd = open (filename, O_RDONLY | O_CLOEXEC | O_BINARY); #else - h->fd = open (filename, O_RDONLY); + h->fd = open (filename, O_RDONLY | O_BINARY); #endif if (h->fd == -1) goto error; @@ -2261,7 +2261,7 @@ hivex_commit (hive_h *h, const char *filename, int flags) } filename = filename ? : h->filename; - int fd = open (filename, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY, 0666); + int fd = open (filename, O_WRONLY|O_CREAT|O_TRUNC|O_NOCTTY|O_BINARY, 0666); if (fd == -1) return -1; -- 1.7.10.4