Hello,

It looks like the system() function as used with linuxthreads (or on
sparc) doesn't block SIGCHLD but resets the default handler instead,
which may result in lost signals if a custom handler was installed.

Attached is a small source file that demonstrates the issue. A patch
will follow as a reply to this message.

Thanks.

-- 
Richard Braun
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>

static void die(const char *f)
{
    perror(f);
    exit(EXIT_FAILURE);
}

#define MSG "SIGCHLD received\n"

static void handle_sigchld(int signum)
{
    (void)signum;

    write(1, MSG, sizeof(MSG) - 1);
}

int main(int argc, char *argv[])
{
    struct sigaction sa;
    char tmp[64];
    int ret;

    sa.sa_handler = handle_sigchld;
    sigemptyset(&sa.sa_mask);
    sa.sa_flags = 0;

    ret = sigaction(SIGCHLD, &sa, NULL);

    if (ret)
        die("sigaction");

    snprintf(tmp, sizeof(tmp), "kill -CHLD %d", getpid());
    ret = system(tmp);

    if (ret == -1)
        die("system");

    return EXIT_SUCCESS;
}
_______________________________________________
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to