diff options
author | Eric Wong <e@80x24.org> | 2023-10-04 03:49:29 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-04 17:46:45 +0000 |
commit | c25764aa34c5945dda48d612e20c7d323ffb782c (patch) | |
tree | 9c63684fe28494bd126a1d30ee52d430a0b6fd93 | |
parent | 4761801ded553ccecc2e4339b0ae32efa8cf6a52 (diff) | |
download | public-inbox-c25764aa34c5945dda48d612e20c7d323ffb782c.tar.gz |
While signals are currently blocked in these helpers, they may not always be...
-rw-r--r-- | lib/PublicInbox/XapHelper.pm | 4 | ||||
-rw-r--r-- | lib/PublicInbox/xap_helper.h | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/XapHelper.pm b/lib/PublicInbox/XapHelper.pm index 8c2b86d6..f90b283d 100644 --- a/lib/PublicInbox/XapHelper.pm +++ b/lib/PublicInbox/XapHelper.pm @@ -109,9 +109,9 @@ sub dump_roots_iter ($$$) { sub dump_roots_flush ($$) { my ($req, $fh) = @_; if ($req->{wbuf} ne '') { - flock($fh, LOCK_EX) or die "flock: $!"; + until (flock($fh, LOCK_EX)) { die "LOCK_EX: $!" if !$!{EINTR} } print { $req->{0} } $req->{wbuf} or die "print: $!"; - flock($fh, LOCK_UN) or die "flock: $!"; + until (flock($fh, LOCK_UN)) { die "LOCK_UN: $!" if !$!{EINTR} } $req->{wbuf} = ''; } } diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h index 5f04316c..a78a3f76 100644 --- a/lib/PublicInbox/xap_helper.h +++ b/lib/PublicInbox/xap_helper.h @@ -441,7 +441,8 @@ static bool dump_roots_flush(struct req *req, struct dump_roots_tmp *drt) } drt->wbuf.fp = NULL; if (!drt->wbuf.len) goto done_free; - if (flock(drt->root2id_fd, LOCK_EX)) { + while (flock(drt->root2id_fd, LOCK_EX)) { + if (errno == EINTR) continue; perror("LOCK_EX"); return false; } @@ -456,7 +457,8 @@ static bool dump_roots_flush(struct req *req, struct dump_roots_tmp *drt) return false; } } while (drt->wbuf.len); - if (flock(drt->root2id_fd, LOCK_UN)) { + while (flock(drt->root2id_fd, LOCK_UN)) { + if (errno == EINTR) continue; perror("LOCK_UN"); return false; } |