Re: [PATCH spice-server 20/33 v2] replay: Force binary mode on input on Windows

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

 



On Thu, Jan 3, 2019 at 3:31 PM Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
>
> If input contains the binary record we can't have it modified
> during read.
>
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Reviewed-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

> ---
>  server/tests/replay.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> Changes since v1:
> - open file passed with name in binary mode too.
>
> diff --git a/server/tests/replay.c b/server/tests/replay.c
> index cbb1c195..b88c03c7 100644
> --- a/server/tests/replay.c
> +++ b/server/tests/replay.c
> @@ -392,8 +392,11 @@ int main(int argc, char **argv)
>
>      if (strncmp(file[0], "-", 1) == 0) {
>          fd = stdin;
> +#ifdef _WIN32
> +        _setmode(fileno(fd), _O_BINARY);
> +#endif
>      } else {
> -        fd = fopen(file[0], "r");
> +        fd = fopen(file[0], "rb");
>      }
>      if (fd == NULL) {
>          g_printerr("error opening %s\n", file[0]);
> --
> 2.20.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]