996407fc5f
Update Source to latest upstream commit Rename files * Previous patches 0001-0020 are now patches 0002-0021 * Previous patches 0021-0028 are now patches 0026-0033 Add 0001-kpartx-Use-absolute-paths-to-create-mappings.patch Add 0022-multipathd-check-for-NULL-udevice-in-cli_add_path.patch Add 0023-libmultipath-remove-max_fds-code-duplication.patch Add 0024-multipathd-set-return-code-for-multipathd-commands.patch Add 0025-mpathpersist-fix-registration-rollback-issue.patch * The above 5 patches have been submitted upstream
99 lines
2.4 KiB
Diff
99 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Mon, 8 Oct 2018 14:49:30 -0500
|
|
Subject: [PATCH] multipathd: set return code for multipathd commands
|
|
|
|
Failed multipathd commands should set the return code to 1.
|
|
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
multipathd/main.c | 8 ++++----
|
|
multipathd/uxclnt.c | 13 ++++++++-----
|
|
2 files changed, 12 insertions(+), 9 deletions(-)
|
|
|
|
diff --git a/multipathd/main.c b/multipathd/main.c
|
|
index d3f7719..2d45d98 100644
|
|
--- a/multipathd/main.c
|
|
+++ b/multipathd/main.c
|
|
@@ -2966,9 +2966,9 @@ main (int argc, char *argv[])
|
|
if (verbosity)
|
|
conf->verbosity = verbosity;
|
|
uxsock_timeout = conf->uxsock_timeout;
|
|
- uxclnt(optarg, uxsock_timeout + 100);
|
|
+ err = uxclnt(optarg, uxsock_timeout + 100);
|
|
free_config(conf);
|
|
- exit(0);
|
|
+ return err;
|
|
case 'B':
|
|
bindings_read_only = 1;
|
|
break;
|
|
@@ -3005,9 +3005,9 @@ main (int argc, char *argv[])
|
|
optind++;
|
|
}
|
|
c += snprintf(c, s + CMDSIZE - c, "\n");
|
|
- uxclnt(s, uxsock_timeout + 100);
|
|
+ err = uxclnt(s, uxsock_timeout + 100);
|
|
free_config(conf);
|
|
- exit(0);
|
|
+ return err;
|
|
}
|
|
|
|
if (foreground) {
|
|
diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c
|
|
index 08db0e8..a76f8e2 100644
|
|
--- a/multipathd/uxclnt.c
|
|
+++ b/multipathd/uxclnt.c
|
|
@@ -103,14 +103,14 @@ static void process(int fd, unsigned int timeout)
|
|
}
|
|
}
|
|
|
|
-static void process_req(int fd, char * inbuf, unsigned int timeout)
|
|
+static int process_req(int fd, char * inbuf, unsigned int timeout)
|
|
{
|
|
char *reply;
|
|
int ret;
|
|
|
|
if (send_packet(fd, inbuf) != 0) {
|
|
printf("cannot send packet\n");
|
|
- return;
|
|
+ return 1;
|
|
}
|
|
ret = recv_packet(fd, &reply, timeout);
|
|
if (ret < 0) {
|
|
@@ -118,9 +118,12 @@ static void process_req(int fd, char * inbuf, unsigned int timeout)
|
|
printf("timeout receiving packet\n");
|
|
else
|
|
printf("error %d receiving packet\n", ret);
|
|
+ return 1;
|
|
} else {
|
|
printf("%s", reply);
|
|
+ ret = (strcmp(reply, "fail\n") == 0);
|
|
FREE(reply);
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
@@ -129,16 +132,16 @@ static void process_req(int fd, char * inbuf, unsigned int timeout)
|
|
*/
|
|
int uxclnt(char * inbuf, unsigned int timeout)
|
|
{
|
|
- int fd;
|
|
+ int fd, ret = 0;
|
|
|
|
fd = mpath_connect();
|
|
if (fd == -1)
|
|
exit(1);
|
|
|
|
if (inbuf)
|
|
- process_req(fd, inbuf, timeout);
|
|
+ ret = process_req(fd, inbuf, timeout);
|
|
else
|
|
process(fd, timeout);
|
|
mpath_disconnect(fd);
|
|
- return 0;
|
|
+ return ret;
|
|
}
|
|
--
|
|
2.7.4
|
|
|