]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
loopdev: accept ENOSYS for LOOP_CONFIGURE
authorAlex Xu <351006+Hello71@users.noreply.github.com>
Wed, 24 Nov 2021 20:34:10 +0000 (20:34 +0000)
committerGitHub <noreply@github.com>
Wed, 24 Nov 2021 20:34:10 +0000 (20:34 +0000)
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

index 679c8d7bcda1e49d4564aab03bf007c1644ed327..b5da1516e37fc1a63a04d9574dfb66f33b607e9c 100644 (file)
@@ -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;
                }