8000 Race condition · Issue #21 · gaultier/blog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Race condition #21
Open
Open
@AnotherOneDeveloper

Description

@AnotherOneDeveloper

6273
int child_pid = fork();
if (-1 == child_pid) {
return errno;
}
if (0 == child_pid) { // Child
argv += 1;
if (-1 == execvp(argv[0], argv)) {
return errno;
}
__builtin_unreachable();
}
sigset_t sigset = {0};
sigemptyset(&sigset);
sigaddset(&sigset, SIGCHLD);
siginfo_t siginfo = {0};
struct timespec timeout = {
.tv_sec = wait_ms / 1000,
.tv_nsec = (wait_ms % 1000) * 1000 * 1000,
};
int sig = sigtimedwait(&sigset, &siginfo, &timeout);

SIGCHLD may come after fork() and before sigtimedwait().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0