diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-12-28 00:36:36 +0100 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-12-28 01:05:20 +0100 |
commit | 314c5323d3a038394f43e84d72594b78d17b1a46 (patch) | |
tree | 5c82135181d99879725f59cc4c263e9ec4e95049 /src/tools | |
parent | 6166259f74855fe9e6976175eeb7b16912bc477a (diff) | |
download | ouroboros-314c5323d3a038394f43e84d72594b78d17b1a46.tar.gz ouroboros-314c5323d3a038394f43e84d72594b78d17b1a46.zip |
include, lib: Report communication failure with the IRMd
An errno EIRMD has been added to errno.h to indicate failure to send a
message tot the IRMd. The IRM tool will report such errors, which
makes it easier for users to detect that the IRM was not started or
has failed.
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/irm/irm.c | 22 | ||||
-rw-r--r-- | src/tools/irm/irm_bind_ap.c | 4 |
2 files changed, 20 insertions, 6 deletions
diff --git a/src/tools/irm/irm.c b/src/tools/irm/irm.c index 7b2f3331..ce92d3d5 100644 --- a/src/tools/irm/irm.c +++ b/src/tools/irm/irm.c @@ -20,12 +20,15 @@ */ #include <ouroboros/irm.h> -#include <stdio.h> -#include <string.h> +#include <ouroboros/errno.h> #include "irm_ops.h" #include "irm_utils.h" +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + static void usage(void) { printf("Usage: irm [OPERATION]\n\n" @@ -71,12 +74,23 @@ static int do_cmd(const char * argv0, return -1; } -int main(int argc, char ** argv) { +int main(int argc, char ** argv) +{ + int ret = 0; if (argc < 2) { usage(); return -1; } - return do_cmd(argv[1], argc - 1, argv + 1); + ret = do_cmd(argv[1], argc - 1, argv + 1); + + if (ret == -EIRMD) + printf("Failed to communicate with the " + "Ouroboros IPC Resource Manager daemon.\n"); + + if (ret) + exit(EXIT_FAILURE); + + exit(EXIT_SUCCESS); } diff --git a/src/tools/irm/irm_bind_ap.c b/src/tools/irm/irm_bind_ap.c index e8e5eb26..a5be5a03 100644 --- a/src/tools/irm/irm_bind_ap.c +++ b/src/tools/irm/irm_bind_ap.c @@ -90,13 +90,13 @@ int do_bind_ap(int argc, char ** argv) ret = irm_bind_ap(ap_name, name, flags, argc, argv); if (ret == -ENOENT) { printf("%s does not exist.\n", ap_name); - return -1; + return ret; } if (ret == -EPERM) { printf("Cannot execute %s, please check permissions.\n", ap_name); - return -1; + return ret; } if (temp != NULL) |