diff options
author | Alex Harpin <development@landsofshadow.co.uk> | 2015-11-24 22:11:13 +0000 |
---|---|---|
committer | Alex Harpin <development@landsofshadow.co.uk> | 2015-11-24 22:11:13 +0000 |
commit | 78048270d567884b425289de5248d83ca710e70a (patch) | |
tree | 83428c88c88b8d03d9c478a873f84dedf636eb2d /src/process.c | |
parent | a78d81af9c6c14e8f9e0235ea5ffc26f37528349 (diff) | |
parent | a96fdeaac8274c0544b0ffa808782932e637a6f5 (diff) | |
download | conntrack-tools-78048270d567884b425289de5248d83ca710e70a.tar.gz conntrack-tools-78048270d567884b425289de5248d83ca710e70a.zip |
Merge tag 'conntrack-tools-1.4.1' into lithium
conntrack-tools 1.4.1 release
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/process.c b/src/process.c index 9b9734c..7f0a395 100644 --- a/src/process.c +++ b/src/process.c @@ -27,25 +27,19 @@ int fork_process_new(int type, int flags, void (*cb)(void *data), void *data) struct child_process *c, *this; int pid; - /* block SIGCHLD to avoid the access of the list concurrently */ - sigprocmask(SIG_BLOCK, &STATE(block), NULL); - /* We only want one process of this type at the same time. This is * useful if you want to prevent two child processes from accessing * a shared descriptor at the same time. */ if (flags & CTD_PROC_F_EXCL) { list_for_each_entry(this, &process_list, head) { if (this->type == type) { - sigprocmask(SIG_UNBLOCK, &STATE(block), NULL); return -1; } } } c = calloc(sizeof(struct child_process), 1); - if (c == NULL) { - sigprocmask(SIG_UNBLOCK, &STATE(block), NULL); + if (c == NULL) return -1; - } c->type = type; c->cb = cb; @@ -55,8 +49,6 @@ int fork_process_new(int type, int flags, void (*cb)(void *data), void *data) if (c->pid > 0) list_add(&c->head, &process_list); - sigprocmask(SIG_UNBLOCK, &STATE(block), NULL); - return pid; } @@ -89,7 +81,6 @@ void fork_process_dump(int fd) char buf[4096]; int size = 0; - sigprocmask(SIG_BLOCK, &STATE(block), NULL); list_for_each_entry(this, &process_list, head) { size += snprintf(buf+size, sizeof(buf), "PID=%u type=%s\n", @@ -97,7 +88,6 @@ void fork_process_dump(int fd) this->type < CTD_PROC_MAX ? process_type_to_name[this->type] : "unknown"); } - sigprocmask(SIG_UNBLOCK, &STATE(block), NULL); send(fd, buf, size, 0); } |