diff options
author | jbj <devnull@localhost> | 2004-03-07 12:50:36 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-03-07 12:50:36 +0000 |
commit | ccc7bf2fd9b68a81fb4a5b95ae9ade845abf6d36 (patch) | |
tree | 140fa92d6fb03dc9696c3126ea68afc837be1ef0 /rpmio | |
parent | 324746dc753372a3bca171a5046c290b1fd4fcd1 (diff) | |
download | librpm-tizen-ccc7bf2fd9b68a81fb4a5b95ae9ade845abf6d36.tar.gz librpm-tizen-ccc7bf2fd9b68a81fb4a5b95ae9ade845abf6d36.tar.bz2 librpm-tizen-ccc7bf2fd9b68a81fb4a5b95ae9ade845abf6d36.zip |
Protect sq->reaped with sighold and sigrelease.
CVS patchset: 7153
CVS date: 2004/03/07 12:50:36
Diffstat (limited to 'rpmio')
-rw-r--r-- | rpmio/rpmsq.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/rpmio/rpmsq.c b/rpmio/rpmsq.c index 8d05caa4d..4fa9f032d 100644 --- a/rpmio/rpmsq.c +++ b/rpmio/rpmsq.c @@ -440,9 +440,8 @@ static int rpmsqWaitUnregister(rpmsq sq) int ret = 0; int xx; - if (same_thread) - ret = sighold(SIGCHLD); - else + ret = sighold(SIGCHLD); + if (!same_thread) ret = pthread_mutex_lock(&sq->mutex); /* Start the child. */ @@ -457,20 +456,22 @@ static int rpmsqWaitUnregister(rpmsq sq) (void) rpmswEnter(&sq->op, -1); /*@-infloops@*/ - while (ret == 0 && sq->reaped != sq->child) { + do { if (same_thread) ret = sigpause(SIGCHLD); - else + else { + xx = sigrelse(SIGCHLD); ret = pthread_cond_wait(&sq->cond, &sq->mutex); - } + xx = sighold(SIGCHLD); + } + } while (ret == 0 && sq->reaped != sq->child); /*@=infloops@*/ sq->ms_scriptlets += rpmswExit(&sq->op, -1)/1000; - if (same_thread) - xx = sigrelse(SIGCHLD); - else + if (!same_thread) xx = pthread_mutex_unlock(&sq->mutex); + xx = sigrelse(SIGCHLD); #ifdef _RPMSQ_DEBUG if (_rpmsq_debug) |