From f6385a6adeea6be255d68016977c5dd5eaab05da Mon Sep 17 00:00:00 2001 From: Alex Xu <351006+Hello71@users.noreply.github.com> Date: Wed, 24 Nov 2021 20:34:10 +0000 Subject: [PATCH] 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. --- lib/loopdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.47.2