svn commit: trunk/busybox: include util-linux

vda at busybox.net vda at busybox.net
Fri Sep 29 21:47:12 UTC 2006


Author: vda
Date: 2006-09-29 14:47:11 -0700 (Fri, 29 Sep 2006)
New Revision: 16264

Log:
losetup: use /dev/loopN or /dev/loop/N according to CONFIG_FEATURE_DEVFS=n/y


Modified:
   trunk/busybox/include/libbb.h
   trunk/busybox/util-linux/losetup.c


Changeset:
Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2006-09-29 21:30:43 UTC (rev 16263)
+++ trunk/busybox/include/libbb.h	2006-09-29 21:47:11 UTC (rev 16264)
@@ -442,6 +442,7 @@
 #endif
 # define VC_FORMAT "/dev/vc/%d"
 # define LOOP_FORMAT "/dev/loop/%d"
+# define LOOP_NAME "/dev/loop/"
 # define FB_0 "/dev/fb/0"
 #else
 # define CURRENT_VC "/dev/tty0"
@@ -461,6 +462,7 @@
 #endif
 # define VC_FORMAT "/dev/tty%d"
 # define LOOP_FORMAT "/dev/loop%d"
+# define LOOP_NAME "/dev/loop"
 # define FB_0 "/dev/fb0"
 #endif
 

Modified: trunk/busybox/util-linux/losetup.c
===================================================================
--- trunk/busybox/util-linux/losetup.c	2006-09-29 21:30:43 UTC (rev 16263)
+++ trunk/busybox/util-linux/losetup.c	2006-09-29 21:47:11 UTC (rev 16264)
@@ -48,11 +48,11 @@
 		printf("%s: %s\n", argv[0], s);
 		if (ENABLE_FEATURE_CLEAN_UP) free(s);
 	} else {
-		char dev[11] = "/dev/loop0";
+		char dev[sizeof(LOOP_NAME"0")] = LOOP_NAME"0";
 		char c;
 		for (c = '0'; c <= '9'; ++c) {
 			char *s;
-			dev[9] = c;
+			dev[sizeof(LOOP_NAME"0")-2] = c;
 			s = query_loop(dev);
 			if (s) {
 				printf("%s: %s\n", dev, s);




More information about the busybox-cvs mailing list