From: Matthias Kruk Date: Sat, 8 Oct 2022 08:21:45 +0000 (+0900) Subject: include/wmutex: Don't write to stderr when wmutex_unlock() fails X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=e23bde303bc1961a72857dd598665c17f5ed7388;p=toolbox include/wmutex: Don't write to stderr when wmutex_unlock() fails When a wmutex could not be unlocked, the rm call in wmutex_unlock() writes an error message directly to stderr. However, the function should only return an error without writing to stderr. This commit modifies wmutex_unlock() so that it does not write to stderr. --- diff --git a/include/wmutex.sh b/include/wmutex.sh index 3ce6f2d..1ba68d7 100644 --- a/include/wmutex.sh +++ b/include/wmutex.sh @@ -52,7 +52,7 @@ wmutex_lock() { wmutex_unlock() { local lock="$1" - if ! rm "$lock"; then + if ! rm "$lock" 2>/dev/null; then return 1 fi