From: Claudio Bley Date: Tue, 24 Sep 2013 09:57:38 +0000 (+0200) Subject: Always open files in binary mode in virFDStreamOpenFileInternal X-Git-Tag: v1.1.3-rc1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f219dca483a753f916b0e0be427c5b8da26ef45;p=thirdparty%2Flibvirt.git Always open files in binary mode in virFDStreamOpenFileInternal On win32, using text mode for binary files might result in short reads since ASCII character 0x1A is interpreted as EOF. Also, it could lead to problems using the seek functions because of the \r handling. Signed-off-by: Claudio Bley --- diff --git a/src/fdstream.c b/src/fdstream.c index 10c7c2af95..f7dae390d0 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -593,7 +593,7 @@ virFDStreamOpenFileInternal(virStreamPtr st, VIR_DEBUG("st=%p path=%s oflags=%x offset=%llu length=%llu mode=%o", st, path, oflags, offset, length, mode); - oflags |= O_NOCTTY; + oflags |= O_NOCTTY | O_BINARY; if (oflags & O_CREAT) fd = open(path, oflags, mode);