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

Marc-André Lureau marcandre.lureau at gmail.com
Thu Jan 3 12:37:22 UTC 2019


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

Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>

> ---
>  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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list