From af0011995826b635658e29b107d33cf9ee7cdd42 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 3 Feb 2013 17:04:36 -0600 Subject: Some older build environments don't have LOOP_CTL_GET_FREE or LOOP_SET_CAPACITY. Substitute constants so they can get the rest of losetup without a build break. --- toys/other/losetup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'toys') diff --git a/toys/other/losetup.c b/toys/other/losetup.c index d279c2ad..c21e840b 100644 --- a/toys/other/losetup.c +++ b/toys/other/losetup.c @@ -75,7 +75,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, LOOP_CTL_GET_FREE))) + if (0 <= (i = ioctl(cfd, 0x4C82))) // LOOP_CTL_GET_FREE sprintf(device = toybuf, "/dev/loop%d", i); close(cfd); } @@ -99,7 +99,8 @@ static void loopback_setup(char *device, char *file) // Check size of file or delete existing association if (flags & (FLAG_c|FLAG_d)) { - if (ioctl(lfd, (flags & FLAG_c) ? LOOP_SET_CAPACITY : LOOP_CLR_FD, 0)) { + // The constant is LOOP_SET_CAPACITY + if (ioctl(lfd, (flags & FLAG_c) ? 0x4C07 : LOOP_CLR_FD, 0)) { perror_msg("%s", device); goto done; } -- cgit v1.2.3