From: Alex Xu <351006+Hello71@users.noreply.github.com> Date: Wed, 24 Nov 2021 20:34:10 +0000 (+0000) Subject: loopdev: accept ENOSYS for LOOP_CONFIGURE X-Git-Tag: v2.38-rc1~145^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f6385a6adeea6be255d68016977c5dd5eaab05da;p=thirdparty%2Futil-linux.git loopdev: accept ENOSYS for LOOP_CONFIGURE qemu returns this if it doesn't understand the ioctl. according to ioctl(2) it should actually return EINVAL, but considering that it's been doing this for at least 20 years already, I doubt there's much appetite for change, considering that it has a slightly better error message if propagated back to the user and changing it to EINVAL may break other programs. --- diff --git a/lib/loopdev.c b/lib/loopdev.c index 679c8d7bcd..b5da1516e3 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -1364,7 +1364,7 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) if (ioctl(dev_fd, LOOP_CONFIGURE, &lc->config) < 0) { rc = -errno; errsv = errno; - if (errno != EINVAL && errno != ENOTTY) { + if (errno != EINVAL && errno != ENOTTY && errno != ENOSYS) { DBG(SETUP, ul_debugobj(lc, "LOOP_CONFIGURE failed: %m")); goto err; }