wok diff busybox/stuff/busybox-1.28-losetup.u @ rev 20205

Up busybox (1.18.1)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 20 18:10:43 2018 +0100 (2018-02-20)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.28-losetup.u	Tue Feb 20 18:10:43 2018 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +keep previous default behaviour and display cloop devices
     1.5 +--- busybox-1.28/util-linux/losetup.c
     1.6 ++++ busybox-1.28/util-linux/losetup.c
     1.7 +@@ -81,17 +81,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 + 	}