Re: [PATCH spice-server 32/33] Use structure for socket_t type instead of just a typedef

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

 



> 
> Hi
> 
> On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
> >
> > Allows the compiler to catch errors mixing int and sockets.
> > Make easier to keep Windows port working.
> >
> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> 
> Ah, I understand the debug code now.
> 
> Still, I think you are being overzealous. Please just use int, like
> everybody else.
> 

I still like the compiler helping me. As Windows won't probably be tested
much the compiler help is welcome.

Main issue is that "int" from open() works well with read(), write()
and similar... but not with socket() on Windows.
As code deal with also file descriptor and other stuff I think would
catch possible bugs. I agree on the int stuff instead of SOCKET type,
still I think the structure (beside the name) would be good.

> 
> > ---
> >  server/sys-socket.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/server/sys-socket.h b/server/sys-socket.h
> > index 9dca563b..361845e2 100644
> > --- a/server/sys-socket.h
> > +++ b/server/sys-socket.h
> > @@ -26,7 +26,7 @@
> >  #ifndef _WIN32
> >  #  include <sys/socket.h>
> >
> > -#if 0
> > +#if ENABLE_EXTRA_CHECKS
> >  typedef struct {
> >      int fd;
> >  } socket_t;

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]