aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2021-05-14 02:17:31 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2021-06-09 20:06:05 +0000
commitd6a0cecab142f25e4a031a645c6ce510aab6c15d (patch)
treef22a6e11c9e3a48a18b91a639f7a0403721f5812
parent2c3d7283b46f0690b671ea31a1577aefe0e8884d (diff)
downloadsrc-d6a0cecab142f25e4a031a645c6ce510aab6c15d.tar.gz
src-d6a0cecab142f25e4a031a645c6ce510aab6c15d.zip
zed-functions.sh: zed_lock(): don't truncate lock
By appending instead of truncating, we can lock on any file (with write permissions) instead of only dedicated lock files, since the locking process itself no longer alters the file in any way Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12042
-rw-r--r--cmd/zed/zed.d/zed-functions.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/zed/zed.d/zed-functions.sh b/cmd/zed/zed.d/zed-functions.sh
index df35c48fdb02..7dcd6b2d20b9 100644
--- a/cmd/zed/zed.d/zed-functions.sh
+++ b/cmd/zed/zed.d/zed-functions.sh
@@ -126,7 +126,7 @@ zed_lock()
# Obtain a lock on the file bound to the given file descriptor.
#
- eval "exec ${fd}> '${lockfile}'"
+ eval "exec ${fd}>> '${lockfile}'"
if ! err="$(flock --exclusive "${fd}" 2>&1)"; then
zed_log_err "failed to lock \"${lockfile}\": ${err}"
fi