runscript: retry prefix flock if it is interrupted by a signal
Reported-by: Pacho Ramos <pacho2@gentoo.org> X-Gentoo-Bug: 434800 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434800
This commit is contained in:
parent
f30eec03ce
commit
970893adf3
@ -311,8 +311,12 @@ write_prefix(const char *buffer, size_t bytes, bool *prefixed)
|
|||||||
lock_fd = open(PREFIX_LOCK, O_WRONLY | O_CREAT, 0664);
|
lock_fd = open(PREFIX_LOCK, O_WRONLY | O_CREAT, 0664);
|
||||||
|
|
||||||
if (lock_fd != -1) {
|
if (lock_fd != -1) {
|
||||||
if (flock(lock_fd, LOCK_EX) != 0)
|
while (flock(lock_fd, LOCK_EX) != 0) {
|
||||||
eerror("flock() failed: %s", strerror(errno));
|
if (errno != EINTR) {
|
||||||
|
eerror("flock() failed: %s", strerror(errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef RC_DEBUG
|
#ifdef RC_DEBUG
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user