diff options
| author | Wouter Franken <wouter.franken_ext@softathome.com> | 2026-01-20 10:28:27 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2026-01-26 05:43:17 +0100 |
| commit | 4e82d99460d36ab09b651eb90c77e7cd13fb368a (patch) | |
| tree | 812c1363c9b276c39e09bd013508f18dc1f04563 | |
| parent | 4da1badf1319c008397ec258f0601f5014332cb3 (diff) | |
| download | busybox-w32-4e82d99460d36ab09b651eb90c77e7cd13fb368a.tar.gz busybox-w32-4e82d99460d36ab09b651eb90c77e7cd13fb368a.tar.bz2 busybox-w32-4e82d99460d36ab09b651eb90c77e7cd13fb368a.zip | |
libbb/loop: fix existence check for LOOP_CONFIGURE ioctl
The LOOP_CONFIGURE ioctl is supported in 5.8 kernels and up. To have
backwards compatibility there is a config option CONFIG_TRY_LOOP_CONFIGURE
that will check if the ioctl exists and if not fall back to old way of
configuring loop devices.
Normally errno will be set to EINVAL when this ioctl does not exist.
However, when kernel config CONFIG_COMPAT is enabled, then compat_ioctl
is called. In that case -ENOIOCTLCMD is returned by loop device driver
and generic ioctl wrapper will set errno to ENOTTY. Because busybox
does not expect this it will fail to mount loop devices in this case.
This patch fixes the check for the existence of the ioctl LOOP_CONFIGURE
by checking if errno is one of both: EINVAL or ENOTTY.
function old new delta
set_loop 809 821 +12
Signed-off-by: Wouter Franken <wouter.franken_ext@softathome.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | libbb/loop.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libbb/loop.c b/libbb/loop.c index a0c5d0259..b603d0daa 100644 --- a/libbb/loop.c +++ b/libbb/loop.c | |||
| @@ -158,7 +158,7 @@ static int set_loopdev_params(int lfd, | |||
| 158 | if (rc == 0) | 158 | if (rc == 0) |
| 159 | return rc; /* SUCCESS! */ | 159 | return rc; /* SUCCESS! */ |
| 160 | # if ENABLE_TRY_LOOP_CONFIGURE | 160 | # if ENABLE_TRY_LOOP_CONFIGURE |
| 161 | if (errno != EINVAL) | 161 | if (errno != EINVAL && errno != ENOTTY) |
| 162 | return rc; /* error other than old kernel */ | 162 | return rc; /* error other than old kernel */ |
| 163 | /* Old kernel, fall through into old way to do it: */ | 163 | /* Old kernel, fall through into old way to do it: */ |
| 164 | # endif | 164 | # endif |
