ipc: Improve error diagnostics for kill.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 16 Apr 2017 10:48:58 +0000 (12:48 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 26 Jul 2017 15:53:20 +0000 (17:53 +0200)
If dss is not running, the kill command prints "No such file or
directory" because the call to semget(2) fails with ENOENT. This
message is a bit misleading, so let's return -E_NOT_RUNNING in this
case instead.

ipc.c

diff --git a/ipc.c b/ipc.c
index 880ce17..0f295a9 100644 (file)
--- a/ipc.c
+++ b/ipc.c
@@ -120,7 +120,7 @@ int get_dss_pid(char *config_file, pid_t *pid)
                *pid = 0;
        ret = mutex_get(key, 0);
        if (ret < 0)
-               return ret;
+               return ret == -ERRNO_TO_DSS_ERROR(ENOENT)? -E_NOT_RUNNING : ret;
        semid = ret;
        ret = semctl(semid, 1, GETPID);
        if (ret < 0)