]> git.corax.cc Git - toolbox/commitdiff
include/inst: Make inst_stop emit a meaningful message upon error
authorMatthias Kruk <m@m10k.eu>
Thu, 15 Apr 2021 23:27:31 +0000 (08:27 +0900)
committerMatthias Kruk <m@m10k.eu>
Thu, 15 Apr 2021 23:27:31 +0000 (08:27 +0900)
Instead of emitting a user-understandable error message, the inst_stop()
function merely lets an error message from the sem module slip through.
This commit changes the function to emit an error message that tells the
caller why exactly the function failed.

include/inst.sh

index d20a8c50169333eb1fa2d54d190cb62a4323ae13..8e900f50971e02967ebe7cd75e9df8f7670bbaae 100644 (file)
@@ -91,7 +91,8 @@ inst_stop() {
 
        sem="$__inst_path/$pid"
 
-       if ! sem_post "$sem"; then
+       if ! sem_post "$sem" &> /dev/null; then
+               log_error "No such instance"
                return 1
        fi