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 880ce1734522c3f2e6f2c9988e69976a5398f967..0f295a9d2e6fc34b600d38594d5bd219afd08ccf 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)
                *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)
        semid = ret;
        ret = semctl(semid, 1, GETPID);
        if (ret < 0)