Commit d215ca3f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Block SIGCHLD so we don't get polluted by system() in another thread[1]

(though this seem to only happen with debuggers and (?)broken OSes)

[1] system() blocks SIGCHLD, and is probably not intended for multithreading

We cannot assume that blocking calls in other libraries ignore EINTR anyway, 
so the only safe approach is to block in all threads (you can unblock it in
your thread if you really want it) except the signal handling thread.
parent 619f831b
...@@ -292,8 +292,6 @@ net_ReadInner (vlc_object_t *restrict p_this, unsigned fdc, const int *fdv, ...@@ -292,8 +292,6 @@ net_ReadInner (vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
switch (poll (ufd, fdc, 500)) switch (poll (ufd, fdc, 500))
{ {
case -1: case -1:
if( errno == EINTR )
continue;
goto error; goto error;
case 0: // timeout case 0: // timeout
...@@ -442,8 +440,6 @@ ssize_t __net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs, ...@@ -442,8 +440,6 @@ ssize_t __net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
switch (val) switch (val)
{ {
case -1: case -1:
if( errno == EINTR )
continue;
msg_Err (p_this, "Write error: %s", net_strerror (net_errno)); msg_Err (p_this, "Write error: %s", net_strerror (net_errno));
goto out; goto out;
......
...@@ -103,7 +103,7 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -103,7 +103,7 @@ int main( int i_argc, char *ppsz_argv[] )
* Note that we set the signals after the vlc_create call. */ * Note that we set the signals after the vlc_create call. */
static const int sigs[] = { SIGINT, SIGHUP, SIGQUIT, SIGTERM }; static const int sigs[] = { SIGINT, SIGHUP, SIGQUIT, SIGTERM };
/* Ignored signals */ /* Ignored signals */
static const int ignored[] = { SIGALRM, SIGPIPE }; static const int ignored[] = { SIGALRM, SIGPIPE, SIGCHLD };
sigset_t set; sigset_t set;
pthread_t sigth; pthread_t sigth;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment