Re: [PATCH 2/2] Always open files in binary mode in virFDStreamOpenFileInternal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/24/2013 03:57 AM, Claudio Bley wrote:
> 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 <cbley@xxxxxxxxxx>
> ---
>  src/fdstream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

ACK.

> 
> diff --git a/src/fdstream.c b/src/fdstream.c
> index 10c7c2a..f7dae39 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);
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]