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:
Alexander Mezin 2013-02-02 15:15:19 -06:00 committed by William Hubbs
parent f30eec03ce
commit 970893adf3

View File

@ -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