summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2009-04-29 15:23:28 -0400
committerMike Snitzer <snitzer@redhat.com>2009-04-29 15:23:28 -0400
commitaa6cb9ad2c555a50e512f31e379fdde2dc17c340 (patch)
treed29d7abfd776e67baa363f082960b11b131cbdbd
parentef341c2fa151b1c5b8ba26633fc28916161a85ff (diff)
downloadmultipath-tools-aa6cb9ad2c555a50e512f31e379fdde2dc17c340.tar.gz
multipath-tools-aa6cb9ad2c555a50e512f31e379fdde2dc17c340.tar.bz2
multipath-tools-aa6cb9ad2c555a50e512f31e379fdde2dc17c340.zip
multipathd: add error checking to client's process_req
If multipathd (server) crashes fail any multipathd (client) communication gracefully. This patch adds error checking that prevents calls to recv_packet() if the send_packet() call failed. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r--multipathd/uxclnt.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/multipathd/uxclnt.c b/multipathd/uxclnt.c
index 6de496b..2882716 100644
--- a/multipathd/uxclnt.c
+++ b/multipathd/uxclnt.c
@@ -79,11 +79,12 @@ static void process_req(int fd, char * inbuf)
char *reply;
size_t len;
- send_packet(fd, inbuf, strlen(inbuf) + 1);
- recv_packet(fd, &reply, &len);
-
- print_reply(reply);
- FREE(reply);
+ if (send_packet(fd, inbuf, strlen(inbuf) + 1) != 0)
+ return;
+ if (recv_packet(fd, &reply, &len) == 0) {
+ print_reply(reply);
+ FREE(reply);
+ }
}
/*