|
|
4728c8 |
---
|
|
|
4728c8 |
multipathd/main.c | 6 ++----
|
|
|
4728c8 |
multipathd/uxclnt.c | 22 +++++++++++++---------
|
|
|
4728c8 |
2 files changed, 15 insertions(+), 13 deletions(-)
|
|
|
4728c8 |
|
|
|
4728c8 |
Index: multipath-tools-130222/multipathd/main.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/multipathd/main.c
|
|
|
4728c8 |
+++ multipath-tools-130222/multipathd/main.c
|
|
|
4728c8 |
@@ -2234,8 +2234,7 @@ main (int argc, char *argv[])
|
|
|
4728c8 |
conf->verbosity = atoi(optarg);
|
|
|
4728c8 |
break;
|
|
|
4728c8 |
case 'k':
|
|
|
4728c8 |
- uxclnt(optarg);
|
|
|
4728c8 |
- exit(0);
|
|
|
4728c8 |
+ return(uxclnt(optarg));
|
|
|
4728c8 |
case 'B':
|
|
|
4728c8 |
conf->bindings_read_only = 1;
|
|
|
4728c8 |
break;
|
|
|
4728c8 |
@@ -2256,8 +2255,7 @@ main (int argc, char *argv[])
|
|
|
4728c8 |
optind++;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
c += snprintf(c, s + CMDSIZE - c, "\n");
|
|
|
4728c8 |
- uxclnt(s);
|
|
|
4728c8 |
- exit(0);
|
|
|
4728c8 |
+ return(uxclnt(s));
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
if (!logsink)
|
|
|
4728c8 |
Index: multipath-tools-130222/multipathd/uxclnt.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/multipathd/uxclnt.c
|
|
|
4728c8 |
+++ multipath-tools-130222/multipathd/uxclnt.c
|
|
|
4728c8 |
@@ -74,20 +74,24 @@ static void process(int fd)
|
|
|
4728c8 |
}
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
-static void process_req(int fd, char * inbuf)
|
|
|
4728c8 |
+static int process_req(int fd, char * inbuf)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
char *reply;
|
|
|
4728c8 |
+ int ret;
|
|
|
4728c8 |
|
|
|
4728c8 |
if (send_packet(fd, inbuf) != 0) {
|
|
|
4728c8 |
printf("cannot send packet\n");
|
|
|
4728c8 |
- return;
|
|
|
4728c8 |
+ return 1;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
- if (recv_packet(fd, &reply) != 0)
|
|
|
4728c8 |
+ if (recv_packet(fd, &reply) != 0) {
|
|
|
4728c8 |
printf("error receiving packet\n");
|
|
|
4728c8 |
- else {
|
|
|
4728c8 |
- printf("%s", reply);
|
|
|
4728c8 |
- FREE(reply);
|
|
|
4728c8 |
+ return 1;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
+ printf("%s", reply);
|
|
|
4728c8 |
+ ret = (strcmp(reply, "fail\n") == 0);
|
|
|
4728c8 |
+ FREE(reply);
|
|
|
4728c8 |
+ /* Need to do better about getting return value */
|
|
|
4728c8 |
+ return ret;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
@@ -95,7 +99,7 @@ static void process_req(int fd, char * i
|
|
|
4728c8 |
*/
|
|
|
4728c8 |
int uxclnt(char * inbuf)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
- int fd;
|
|
|
4728c8 |
+ int fd, ret = 0;
|
|
|
4728c8 |
|
|
|
4728c8 |
fd = mpath_connect();
|
|
|
4728c8 |
if (fd == -1) {
|
|
|
4728c8 |
@@ -104,9 +108,9 @@ int uxclnt(char * inbuf)
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
if (inbuf)
|
|
|
4728c8 |
- process_req(fd, inbuf);
|
|
|
4728c8 |
+ ret = process_req(fd, inbuf);
|
|
|
4728c8 |
else
|
|
|
4728c8 |
process(fd);
|
|
|
4728c8 |
|
|
|
4728c8 |
- return 0;
|
|
|
4728c8 |
+ return ret;
|
|
|
4728c8 |
}
|