aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-03-20 15:25:25 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2002-03-20 15:25:25 +0000
commit3c60a70f32721cf141c0843f8ba61ef83eb3b64c (patch)
tree0215ecc98493231be315f1c8d0288d16b32c1cce
parentae7a3346b61f4a2e1b5166b6ffd78fcbeaedd3f7 (diff)
downloadbusybox-w32-3c60a70f32721cf141c0843f8ba61ef83eb3b64c.tar.gz
busybox-w32-3c60a70f32721cf141c0843f8ba61ef83eb3b64c.tar.bz2
busybox-w32-3c60a70f32721cf141c0843f8ba61ef83eb3b64c.zip
Fix devfs loop device support
git-svn-id: svn://busybox.net/trunk/busybox@4447 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--include/libbb.h2
-rw-r--r--libbb/loop.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 8dadfd958..cf593d65c 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -270,6 +270,7 @@ extern const char * const can_not_create_raw_socket;
270# define SC_1 "/dev/tts/1" 270# define SC_1 "/dev/tts/1"
271# define VC_FORMAT "/dev/vc/%d" 271# define VC_FORMAT "/dev/vc/%d"
272# define SC_FORMAT "/dev/tts/%d" 272# define SC_FORMAT "/dev/tts/%d"
273# define LOOP_FORMAT "/dev/loop/%d"
273#else 274#else
274# define CURRENT_VC "/dev/tty0" 275# define CURRENT_VC "/dev/tty0"
275# define VC_1 "/dev/tty1" 276# define VC_1 "/dev/tty1"
@@ -281,6 +282,7 @@ extern const char * const can_not_create_raw_socket;
281# define SC_1 "/dev/ttyS1" 282# define SC_1 "/dev/ttyS1"
282# define VC_FORMAT "/dev/tty%d" 283# define VC_FORMAT "/dev/tty%d"
283# define SC_FORMAT "/dev/ttyS%d" 284# define SC_FORMAT "/dev/ttyS%d"
285# define LOOP_FORMAT "/dev/loop%d"
284#endif 286#endif
285 287
286/* The following devices are the same on devfs and non-devfs systems. */ 288/* The following devices are the same on devfs and non-devfs systems. */
diff --git a/libbb/loop.c b/libbb/loop.c
index 36b13d6e6..7e58b2f85 100644
--- a/libbb/loop.c
+++ b/libbb/loop.c
@@ -95,7 +95,7 @@ extern char *find_unused_loop_device(void)
95 struct loop_info loopinfo; 95 struct loop_info loopinfo;
96 96
97 for (i = 0; i <= 7; i++) { 97 for (i = 0; i <= 7; i++) {
98 sprintf(dev, "/dev/loop%d", i); 98 sprintf(dev, LOOP_FORMAT, i);
99 if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { 99 if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
100 if ((fd = open(dev, O_RDONLY)) >= 0) { 100 if ((fd = open(dev, O_RDONLY)) >= 0) {
101 if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) != 0) { 101 if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) != 0) {