Skip to contentSkip to conversation

multipath: fix multipath -l <devmap> without output

PATCH In review Mauricio Faria de Oliveira 2 participants 2 messages Jul 25, 2016 – Jul 31, 2016 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath: fix multipath -l <devmap> without output

Currently, the multipath -l <devmap> output is empty, and an error is printed to syslog:

    # ./multipath -l mpatha
    #
    # echo $?
    1
    # tail /var/log/messages
    ...
    ... multipath: mpatha: can't get udev device

That's due to dev_type not being initialized, and incorrectly evaluated. So, initialize it to DEV_NONE, which is verified/reset by get_dev_type().

Now there's actual output and no error in syslog:

    # ./multipath -l mpatha
    mpatha (3600a0b800011e95c000055d855167d1c) dm-0 IBM,1815      FAStT
    ...
    # echo $?
    0

(tested on '2613ce0 Bump version code to 0.6.2')

---
 multipath/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
multipath/main.c +1 -1
index 6ccece7..93376a9 100644
@@ -511,7 +511,7 @@ main (int argc, char *argv[])
 	extern int optind;
 	int r = 1;
 	enum mpath_cmds cmd = CMD_CREATE;
-	enum devtypes dev_type;
+	enum devtypes dev_type = DEV_NONE;
 	char *dev = NULL;
 	struct config *conf;
 
Signature · 1 line
1.8.3.1
#1 lore raw

Merged.
Thanks.

Quoted 49 lines · Mauricio Faria de Oliveira

Currently, the multipath -l <devmap> output is empty, and an error is printed to syslog:

    # ./multipath -l mpatha
    #
    # echo $?
    1
    # tail /var/log/messages
    ...
    ... multipath: mpatha: can't get udev device

That's due to dev_type not being initialized, and incorrectly evaluated. So, initialize it to DEV_NONE, which is verified/reset by get_dev_type().

Now there's actual output and no error in syslog:

    # ./multipath -l mpatha
    mpatha (3600a0b800011e95c000055d855167d1c) dm-0 IBM,1815      FAStT
    ...
    # echo $?
    0

(tested on '2613ce0 Bump version code to 0.6.2')

---
 multipath/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
multipath/main.c +1 -2
index 6ccece7..93376a9 100644
@@ -511,7 +511,7 @@ main (int argc, char *argv[])
        extern int optind;
        int r = 1;
        enum mpath_cmds cmd = CMD_CREATE;
-       enum devtypes dev_type;
+       enum devtypes dev_type = DEV_NONE;
        char *dev = NULL;
        struct config *conf;
 
--

1.8.3.1