| 1 | commit d2aef8b3967e53fe58178f5af50fef488ee0faed |
| 2 | Author: Jens Muecke <jens@nons.de> |
| 3 | Date: Thu Jan 26 00:37:52 2012 +0100 |
| 4 | |
| 5 | 120-portability |
| 6 | |
| 7 | diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c |
| 8 | index c01e0b9..2e2f320 100644 |
| 9 | --- a/copy/xfs_copy.c |
| 10 | +++ b/copy/xfs_copy.c |
| 11 | @@ -463,6 +463,15 @@ read_ag_header(int fd, xfs_agnumber_t agno, wbuf *buf, ag_header_t *ag, |
| 12 | } |
| 13 | |
| 14 | |
| 15 | +static void sig_mask(int type) |
| 16 | +{ |
| 17 | + sigset_t mask; |
| 18 | + sigemptyset(&mask); |
| 19 | + sigaddset(&mask, SIGCHLD); |
| 20 | + sigprocmask(type, &mask, NULL); |
| 21 | +} |
| 22 | + |
| 23 | + |
| 24 | void |
| 25 | write_wbuf(void) |
| 26 | { |
| 27 | @@ -478,9 +487,9 @@ write_wbuf(void) |
| 28 | if (target[i].state != INACTIVE) |
| 29 | pthread_mutex_unlock(&targ[i].wait); /* wake up */ |
| 30 | |
| 31 | - sigrelse(SIGCHLD); |
| 32 | + sig_mask(SIG_UNBLOCK); |
| 33 | pthread_mutex_lock(&mainwait); |
| 34 | - sighold(SIGCHLD); |
| 35 | + sig_mask(SIG_BLOCK); |
| 36 | } |
| 37 | |
| 38 | |
| 39 | @@ -847,7 +856,7 @@ main(int argc, char **argv) |
| 40 | /* set up sigchild signal handler */ |
| 41 | |
| 42 | signal(SIGCHLD, handler); |
| 43 | - sighold(SIGCHLD); |
| 44 | + sig_mask(SIG_BLOCK); |
| 45 | |
| 46 | /* make children */ |
| 47 | |
| 48 | |