[vlc-devel] Use MSG_NOSIGNAL in send()/sendto()/sendmsg()
KO Myung-Hun
komh78 at gmail.com
Mon May 18 14:25:00 CEST 2015
Rémi Denis-Courmont wrote:
> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 17 10:58:38 2015 +0300| [8d03dee93cc5a9598e0485344a3ec237d4ae8846] | committer: Rémi Denis-Courmont
>
> Use MSG_NOSIGNAL in send()/sendto()/sendmsg()
>
> This avoids SIGPIPE firing when writing to a remote-closed connection-
> oriented socket (it is useless for datagram sockets or on Windows
> though). SIGPIPE is blocked ins VLC, but not necessarily in LibVLC.
>
> The problem remains for write() on broken pipe and sockets.
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8d03dee93cc5a9598e0485344a3ec237d4ae8846
> ---
>
> bin/rootwrap.c | 4 ++--
> include/vlc_network.h | 4 ++++
> modules/lua/libs/net.c | 3 ++-
> src/network/httpd.c | 2 +-
> src/network/rootbind.c | 2 +-
> 5 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/bin/rootwrap.c b/bin/rootwrap.c
> index 37d8839..6e49ee8 100644
> --- a/bin/rootwrap.c
> +++ b/bin/rootwrap.c
> @@ -68,7 +68,7 @@ static inline int is_allowed_port (uint16_t port)
>
> static inline int send_err (int fd, int err)
> {
> - return send (fd, &err, sizeof (err), 0) == sizeof (err) ? 0 : -1;
> + return send(fd, &err, sizeof (err), MSG_NOSIGNAL) == sizeof (err) ? 0 : -1;
> }
>
> /**
> @@ -99,7 +99,7 @@ static int send_fd (int p, int fd)
> memcpy (CMSG_DATA (cmsg), &fd, sizeof (fd));
> hdr.msg_controllen = cmsg->cmsg_len;
>
> - return sendmsg (p, &hdr, 0) == sizeof (val) ? 0 : -1;
> + return sendmsg(p, &hdr, MSG_NOSIGNAL) == sizeof (val) ? 0 : -1;
> }
>
>
Hi/2.
This breaks OS/2 build.
-----
CC rootwrap.o
rootwrap.c: In function 'send_err':
rootwrap.c:71:41: error: 'MSG_NOSIGNAL' undeclared (first use in this
function)
return send(fd, &err, sizeof (err), MSG_NOSIGNAL) == sizeof (err) ?
0 : -1;
^
rootwrap.c:71:41: note: each undeclared identifier is reported only once
for each function it appears in
rootwrap.c: In function 'send_fd':
rootwrap.c:102:29: error: 'MSG_NOSIGNAL' undeclared (first use in this
function)
return sendmsg(p, &hdr, MSG_NOSIGNAL) == sizeof (val) ? 0 : -1;
^
rootwrap.c:103:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^
rootwrap.c: In function 'send_err':
rootwrap.c:72:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^
make.exe[2]: *** [rootwrap.o] Error 1
-----
--
KO Myung-Hun
Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM
Korean OS/2 User Community : http://www.ecomstation.co.kr
More information about the vlc-devel
mailing list