wok-6.x view busybox/stuff/busybox-1.23-losetup.u @ rev 18499

Up libfm, libfm-gtk
author Xander Ziiryanoff <psychomaniak@xakep.ru>
date Tue Oct 13 19:56:52 2015 +0200 (2015-10-13)
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 }