Skip to contentSkip to conversation

multipath-tools multipath/Makefile multipathd/ ...

PATCH [email protected] 1 participant 1 message May 6, 2009 Device mapper

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: [email protected] 2009-05-06 17:26:45

Modified files:
multipath : Makefile
multipathd : cli.c main.c uxclnt.c

Log message:

	Fix for bz #484711
	Make failed commands to multipathd -k"cmd" return exit code 1

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/Makefile.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.17.2.1&r2=1.17.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/cli.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.2.3&r2=1.5.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.20&r2=1.69.2.21
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/uxclnt.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.7&r2=1.7.2.1

multipath/Makefile +1 -1
@@ -42,7 +42,7 @@
 	install -d $(DESTDIR)$(mandir)
 	install -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
 	install -d $(DESTDIR)$(man5dir)
-	install -m 644 $(EXEC).5 $(DESTDIR)$(man5dir)
+	install -m 644 $(EXEC).conf.5 $(DESTDIR)$(man5dir)
 	@if [ ! -e $(DESTDIR)/etc/multipath.conf ]; then \
 		install -m 644 multipath.conf.redhat  $(DESTDIR)/etc/multipath.conf; \
 	fi
multipathd/cli.c +1 -0
@@ -311,6 +311,7 @@
 		return NULL;
 
 	p = reply;
+	p += sprintf(p, "fail\n");
 	p += sprintf(p, VERSION_STRING);
 	p += sprintf(p, "CLI commands reference:\n");
 
multipathd/main.c +2 -2
@@ -1756,8 +1756,8 @@
 			conf->verbosity = atoi(optarg);
 			break;
 		case 'k':
-			uxclnt(optarg);
-			exit(0);
+			err = uxclnt(optarg);
+			exit(err);
 		default:
 			;
 		}
multipathd/uxclnt.c +9 -3
@@ -51,16 +51,21 @@
 	}
 }
 
-static void process_req(int fd, char * inbuf)
+static int process_req(int fd, char * inbuf)
 {
 	char *reply;
 	size_t len;
+	int ret = 0;
 
 	send_packet(fd, inbuf, strlen(inbuf) + 1);
 	recv_packet(fd, &reply, &len);
 
+	if (strncmp(reply, "fail\n", 5) == 0)
+		ret = 1;
 	printf("%s", reply);
 	FREE(reply);
+
+	return ret;
 }
 	
 /*
@@ -69,6 +74,7 @@
 int uxclnt(char * inbuf)
 {
 	int fd;
+	int r = 0;
 
 	fd = ux_socket_connect(DEFAULT_SOCKET);
 	if (fd == -1) {
@@ -77,9 +83,9 @@
 	}
 
 	if (inbuf)
-		process_req(fd, inbuf);
+		r = process_req(fd, inbuf);
 	else
 		process(fd);
 	
-	return 0;
+	return r;
 }