OSDN Git Service

losetup: Fix loop mounting
authorGabriele M <moto.falcon.git@gmail.com>
Sun, 20 Nov 2016 21:04:36 +0000 (22:04 +0100)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 25 Oct 2017 03:11:55 +0000 (11:11 +0800)
Vold creates the loop blocks in /dev/block.

Change-Id: Ie926ce672deae4a3494aad2ea19d44d7be60ec97

toys/other/losetup.c

index 4e467a9..6b0a757 100644 (file)
@@ -76,7 +76,7 @@ static void loopback_setup(char *device, char *file)
     // mount -o loop depends on found device being at the start of toybuf.
     if (cfd != -1) {
       if (0 <= (i = ioctl(cfd, 0x4C82))) // LOOP_CTL_GET_FREE
-        sprintf(device = toybuf, "/dev/loop%d", i);
+        sprintf(device = toybuf, "/dev/block/loop%d", i);
       close(cfd);
     }
   }