aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Mezin <mezin.alexander@gmail.com>2013-02-02 15:15:19 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2013-02-15 13:28:35 -0600
commit970893adf3a2f0f7330c4839a716566de14171a3 (patch)
treeea2129665d7881e0c754eba70a40c2f57e1a25ce
parentf30eec03ce228cc807c84e32823c24e159c7db20 (diff)
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
-rw-r--r--src/rc/runscript.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index e504e4a9..0eea335f 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -311,8 +311,12 @@ write_prefix(const char *buffer, size_t bytes, bool *prefixed)
lock_fd = open(PREFIX_LOCK, O_WRONLY | O_CREAT, 0664);
if (lock_fd != -1) {
- if (flock(lock_fd, LOCK_EX) != 0)
- eerror("flock() failed: %s", strerror(errno));
+ while (flock(lock_fd, LOCK_EX) != 0) {
+ if (errno != EINTR) {
+ eerror("flock() failed: %s", strerror(errno));
+ break;
+ }
+ }
}
#ifdef RC_DEBUG
else