Failed multipathd commands should set the return code to 1.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
if (verbosity)
conf->verbosity = verbosity;
uxsock_timeout = conf->uxsock_timeout;
if (verbosity)
conf->verbosity = verbosity;
uxsock_timeout = conf->uxsock_timeout;
- uxclnt(optarg, uxsock_timeout + 100);
+ err = uxclnt(optarg, uxsock_timeout + 100);
case 'B':
bindings_read_only = 1;
break;
case 'B':
bindings_read_only = 1;
break;
optind++;
}
c += snprintf(c, s + CMDSIZE - c, "\n");
optind++;
}
c += snprintf(c, s + CMDSIZE - c, "\n");
- uxclnt(s, uxsock_timeout + 100);
+ err = uxclnt(s, uxsock_timeout + 100);
-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");
{
char *reply;
int ret;
if (send_packet(fd, inbuf) != 0) {
printf("cannot send packet\n");
}
ret = recv_packet(fd, &reply, timeout);
if (ret < 0) {
}
ret = recv_packet(fd, &reply, timeout);
if (ret < 0) {
printf("timeout receiving packet\n");
else
printf("error %d receiving packet\n", ret);
printf("timeout receiving packet\n");
else
printf("error %d receiving packet\n", ret);
} else {
printf("%s", reply);
} else {
printf("%s", reply);
+ ret = (strcmp(reply, "fail\n") == 0);
*/
int uxclnt(char * inbuf, unsigned int timeout)
{
*/
int uxclnt(char * inbuf, unsigned int timeout)
{
fd = mpath_connect();
if (fd == -1)
exit(1);
if (inbuf)
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);
else
process(fd, timeout);
mpath_disconnect(fd);