[PATCH 2/2] tools: Add check for irm ipcp list

  • From: Sander Vrijders <sander.vrijders@xxxxxxxx>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Wed, 25 Apr 2018 12:33:31 +0200

This adds a check in the irm ipcp list command to see if
irm_list_ipcps returned an error or not. Before it was only checking
if there were zero IPCPs in the system.

Signed-off-by: Sander Vrijders <sander.vrijders@xxxxxxxx>
---
 src/tools/irm/irm_ipcp_list.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/tools/irm/irm_ipcp_list.c b/src/tools/irm/irm_ipcp_list.c
index e16ca52..5a9ecaf 100644
--- a/src/tools/irm/irm_ipcp_list.c
+++ b/src/tools/irm/irm_ipcp_list.c
@@ -37,6 +37,7 @@
  */
 
 #include <ouroboros/irm.h>
+#include <ouroboros/errno.h>
 
 #include "irm_ops.h"
 #include "irm_utils.h"
@@ -130,7 +131,12 @@ int do_list_ipcp(int     argc,
         if (len == 0) {
                 printf("No IPCPs in system.\n\n");
                 return 0;
-        }
+        } else if (len == -EIRMD) {
+                printf("Failed to communicate with the "
+                       "Ouroboros IPC Resource Manager daemon.\n");
+                return -1;
+        } else if (len < 0)
+                return len;
 
         /* FIXME: Implement filtering based on type and name. */
         (void) type;
@@ -138,7 +144,8 @@ int do_list_ipcp(int     argc,
 
         printf("+---------+----------------------+------------+"
                "----------------------+\n");
-        printf("| %7s | %20s | %10s | %20s |\n", "pid", "name", "type", 
"layer");
+        printf("| %7s | %20s | %10s | %20s |\n", "pid", "name",
+               "type", "layer");
         printf("+---------+----------------------+------------+"
                "----------------------+\n");
 
-- 
2.17.0


Other related posts:

  • » [PATCH 2/2] tools: Add check for irm ipcp list - Sander Vrijders