[PATCH] ctl: should return NULL when dmsetup fail in find_dm_name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



when dmsetup fail in find_dm_name, it should return NULL,if don't
do it. it will cause core dump in get_dm when do free(name).

Signed-off-by: fanchaoting<fanchaoting@xxxxxxxxxxxxxx>

---
 ctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ctl.c b/ctl.c
index 2071b0e..0ac1c44 100644
--- a/ctl.c
+++ b/ctl.c
@@ -489,7 +489,7 @@ find_dm_name(int major, int minor)
        if (((fd = get_output("/sbin/dmsetup", argv)) == -1) ||
            ((fp = fdopen(fd, "r")) == NULL)) {
                printf("%s: get_output/fdopen failed\n", __func__);
-               return;
+               return NULL;
        }
        while (fgets(buf, sizeof (buf), fp) != NULL) {
                t = __token_init(buf, '\t');
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux