[PATCH 06/13] losetup: allow -j option argument to be relative path

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

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 sys-utils/losetup.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index 45e46c8..8f3614e 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -23,6 +23,7 @@
 #include "closestream.h"
 #include "optutils.h"
 #include "xalloc.h"
+#include "canonicalize.h"
 
 enum {
 	A_CREATE = 1,		/* setup a new device */
@@ -167,9 +168,15 @@ static int show_all_loops(struct loopdev_cxt *lc, const char *file,
 		st = NULL;
 
 	while (loopcxt_next(lc) == 0) {
-
-		if (file && !loopcxt_is_used(lc, st, file, offset, flags))
-			continue;
+		if (file && !loopcxt_is_used(lc, st, file, offset, flags)) {
+			char *canonized;
+			int ret;
+			canonized = canonicalize_path(file);
+			ret = loopcxt_is_used(lc, st, canonized, offset, flags);
+			free(canonized);
+			if (!ret)
+				continue;
+		}
 		printf_loopdev(lc);
 	}
 	loopcxt_deinit_iterator(lc);
-- 
1.8.2

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




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux