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

include/mutex.sh

index 32ee3209ddbdf8bc0ee3e486e7564f7c162896f5..f24093813223955103000d5420d89c5e1fbe67e0 100644 (file)
@@ -62,7 +62,7 @@ mutex_unlock() {
                return 2
        fi
 
-       if ! rm "$lock"; then
+       if ! rm "$lock" 2>/dev/null; then
                return 3
        fi