From c7a3fb96d0936bbbedc428eafd3701edd219f70a Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 20 Mar 2002 15:25:25 +0000 Subject: [PATCH] Fix devfs loop device support --- include/libbb.h | 2 ++ libbb/loop.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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; # define SC_1 "/dev/tts/1" # define VC_FORMAT "/dev/vc/%d" # define SC_FORMAT "/dev/tts/%d" +# define LOOP_FORMAT "/dev/loop/%d" #else # define CURRENT_VC "/dev/tty0" # define VC_1 "/dev/tty1" @@ -281,6 +282,7 @@ extern const char * const can_not_create_raw_socket; # define SC_1 "/dev/ttyS1" # define VC_FORMAT "/dev/tty%d" # define SC_FORMAT "/dev/ttyS%d" +# define LOOP_FORMAT "/dev/loop%d" #endif /* 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) struct loop_info loopinfo; for (i = 0; i <= 7; i++) { - sprintf(dev, "/dev/loop%d", i); + sprintf(dev, LOOP_FORMAT, i); if (stat(dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { if ((fd = open(dev, O_RDONLY)) >= 0) { if (ioctl(fd, LOOP_GET_STATUS, &loopinfo) != 0) { -- 2.25.1