wok-6.x view busybox/stuff/busybox-1.23-losetup.u @ rev 19568
Up qt4 (4.8.7)
author | Xander Ziiryanoff <psychomaniak@xakep.ru> |
---|---|
date | Thu Dec 22 15:11:17 2016 +0100 (2016-12-22) |
parents | |
children | 5a847ebc42a9 |
line source
1 keep previous default behaviour and display cloop devices
2 --- busybox-1.23.0/util-linux/losetup.c
3 +++ busybox-1.23.0/util-linux/losetup.c
4 @@ -71,16 +71,20 @@
6 /* -a */
7 - if (opt == OPT_a) {
8 + if (opt == OPT_a || (!opt && !argv[0])) {
9 - int n;
10 + int i, n;
11 + static char *fmt[3] = { LOOP_FORMAT, "/dev/cloop", "/dev/cloop%u" };
12 +
13 + for (i = 0; i < 3; i++)
14 for (n = 0; n < MAX_LOOP_NUM; n++) {
15 char *s;
17 - sprintf(dev, LOOP_FORMAT, n);
18 + sprintf(dev, fmt[i], n);
19 s = query_loop(dev);
20 if (s) {
21 printf("%s: %s\n", dev, s);
22 free(s);
23 }
24 + if (i == 1) break; /* /dev/cloop */
25 }
26 return EXIT_SUCCESS;
27 }