Blame SOURCES/0252-RHBZ-1623595-cmd-error-status.patch

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