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

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

 



> 
> On Fri, Dec 21, 2018 at 4:04 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>
> 
> Or the more portable
> freopen(NULL, "rb", stdin);?
> 
> anyway
> Reviewed-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> 

Unfortunately is not supported under Windows, at least according to
documentation. g_freopen suffers the same issue.
Also usually MingW uses an old CRT library which for compatibility
does not support much C99.

> 
> > ---
> >  server/tests/replay.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/server/tests/replay.c b/server/tests/replay.c
> > index cbb1c195..c8e10d0a 100644
> > --- a/server/tests/replay.c
> > +++ b/server/tests/replay.c
> > @@ -392,6 +392,9 @@ 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");
> >      }

Frediano
_______________________________________________
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]