multipathd: fix some small bugs for cli socket
PATCH 1/1 multipathd: fix some small bugs for cli socket
From: "tang.junhui" <[email protected]>
1) mpath_recv_reply_len() should return error when the length which received by read_all() is wrong;
2) The buffer which *reply point to maybe null when mpath_recv_reply() return with success, so the caller needs to determine whether it is null, and then to use
it.
Signed-off-by tang.junhui <[email protected]>
--- libmpathcmd/mpath_cmd.c | 2 +- multipathd/uxclnt.c | 3 +++ multipathd/uxlsnr.c | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-)
libmpathcmd/mpath_cmd.c +1 -1
@@ -112,7 +112,7 @@ ssize_t mpath_recv_reply_len(int fd, unsigned int timeout)return ret;if (ret !=sizeof (len)) { errno =EIO ; -return ret; +return -1 ; }return len; }
multipathd/uxclnt.c +3 -0
@@ -28,6 +28,9 @@static void print_reply (char *s) { +if (!s) +return ; +if (isatty (1 )) {printf ("%s" , s);return ;
multipathd/uxlsnr.c +4 -0
@@ -243,6 +243,10 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, void * trigger_data)dead_client (c);continue ; } +if (!inbuf) { +condlog (4 ,"recv_packet get null request" ); +continue ; + }condlog (4 ,"cli[%d]: Got request [%s]" , i, inbuf); uxsock_trigger(inbuf, &reply, &rlen,
Signature · 1 line
2.8.1.windows.1