]> git.corax.cc Git - toolbox/commitdiff
include/wmutex: Don't write to stderr when wmutex_unlock() fails
authorMatthias Kruk <m@m10k.eu>
Sat, 8 Oct 2022 08:21:45 +0000 (17:21 +0900)
committerMatthias Kruk <m@m10k.eu>
Sat, 8 Oct 2022 08:21:45 +0000 (17:21 +0900)
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.

include/wmutex.sh

index 3ce6f2dfc6da9973419704f2a72fb39eb89e32f0..1ba68d7af0196ec2f305b041c8828914c515dc4d 100644 (file)
@@ -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