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