wok-6.x view busybox/stuff/busybox-1.30-losetup.u @ rev 23018
updated libcdio-paranoia and libcdio-paranoia-dev (10.2+0.94+2 -> 10.2.2.0.1)
author | Hans-G?nter Theisgen |
---|---|
date | Tue Mar 03 13:55:44 2020 +0100 (2020-03-03) |
parents | |
children |
line source
1 keep previous default behaviour and display cloop devices
2 --- busybox-1.30/util-linux/losetup.c
3 +++ busybox-1.30/util-linux/losetup.c
4 @@ -81,17 +81,21 @@
5 }
7 /* -a */
8 - if (opt == OPT_a) {
9 - int n;
10 + if (opt == OPT_a || (!opt && !argv[0])) {
11 + int i, n;
12 + static const char *fmt[3] = { LOOP_FORMAT, "/dev/cloop", "/dev/cloop%u" };
13 +
14 + for (i = 0; i < 3; i++)
15 for (n = 0; n < MAX_LOOP_NUM; n++) {
16 char *s;
18 - sprintf(dev, LOOP_FORMAT, n);
19 + sprintf(dev, fmt[i], n);
20 s = query_loop(dev);
21 if (s) {
22 printf("%s: %s\n", dev, s);
23 free(s);
24 }
25 + if (i == 1) break; /* /dev/cloop */
26 }
27 return EXIT_SUCCESS;
28 }