wok diff busybox/stuff/busybox-1.31-losetup.u @ rev 21937
Up nnn (2.7)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Oct 07 18:30:01 2019 +0200 (2019-10-07) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/busybox/stuff/busybox-1.31-losetup.u Mon Oct 07 18:30:01 2019 +0200 1.3 @@ -0,0 +1,28 @@ 1.4 +keep previous default behaviour and display cloop devices 1.5 +--- busybox-1.31/util-linux/losetup.c 1.6 ++++ busybox-1.31/util-linux/losetup.c 1.7 +@@ -96,17 +96,21 @@ 1.8 + } 1.9 + 1.10 + /* -a */ 1.11 +- if (opt == OPT_a) { 1.12 +- int n; 1.13 ++ if (opt == OPT_a || (!opt && !argv[0])) { 1.14 ++ int i, n; 1.15 ++ static const char *fmt[3] = { LOOP_FORMAT, "/dev/cloop", "/dev/cloop%u" }; 1.16 ++ 1.17 ++ for (i = 0; i < 3; i++) 1.18 + for (n = 0; n < MAX_LOOP_NUM; n++) { 1.19 + char *s; 1.20 + 1.21 +- sprintf(dev, LOOP_FORMAT, n); 1.22 ++ sprintf(dev, fmt[i], n); 1.23 + s = query_loop(dev); 1.24 + if (s) { 1.25 + printf("%s: %s\n", dev, s); 1.26 + free(s); 1.27 + } 1.28 ++ if (i == 1) break; /* /dev/cloop */ 1.29 + } 1.30 + return EXIT_SUCCESS; 1.31 + }