summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-01 15:13:16 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-11-01 15:13:16 +0100
commitce07e92f0592ebd0af0ad8c5828dd8f0a7b67da4 (patch)
tree86627cad66767bf84e40c4fb69063b8a17e88f63
parent7ea3a628613c333ad290797bcb7f4df0a7e11fa2 (diff)
libfshelp: Fix record lock when len=0
When len=0 and start is completely before an existing lock, there is no interference. * libfshelp/rlock-tweak.c (fshelp_rlock_tweak): Fix test when len=0.
-rw-r--r--libfshelp/rlock-tweak.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libfshelp/rlock-tweak.c b/libfshelp/rlock-tweak.c
index 8edc53b94..b0f4b9f5f 100644
--- a/libfshelp/rlock-tweak.c
+++ b/libfshelp/rlock-tweak.c
@@ -312,10 +312,8 @@ fshelp_rlock_tweak (struct rlock_box *box, pthread_mutex_t *mutex,
return 0;
}
}
- else if (l->start < start
- && (len == 0
- || (start <= l->start + l->len
- && start + len > l->start + l->len)))
+ else if (l->start < start && start <= l->start + l->len
+ && (len == 0 || start + len > l->start + l->len))
/* Our start falls within the locked region or exactly one
byte after it and our end falls beyond it. We know that
we cannot consume the entire region. */