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

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