[dm-devel] [PATCH] Fixing the find_loop_by_file function to properly compare the filename by respecting the LO_NAME_SIZE.

Jorge Niedbalski jorge.niedbalski at canonical.com
Fri Jun 26 19:08:51 UTC 2015


This fixes the bug reported on https://bugs.launchpad.net/ubuntu/+source/mult
ipath-tools/+bug/1469143

Signed-off-by: Jorge Niedbalski <jorge.niedbalski at canonical.com>
---
 kpartx/lopart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kpartx/lopart.c b/kpartx/lopart.c
index 6f83048..e92aeed 100644
--- a/kpartx/lopart.c
+++ b/kpartx/lopart.c
@@ -123,7 +123,7 @@ find_loop_by_file (const char * filename)
  continue;
  }

- if (0 == strcmp(filename, loopinfo.lo_name)) {
+ if (0 == strncmp(filename, loopinfo.lo_name, strlen(l
oopinfo.lo_name))) {
  close (fd);
  return xstrdup(dev); /*found */
  }
-- 
2.1.4




More information about the dm-devel mailing list