aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-02-03 17:04:36 -0600
committerRob Landley <rob@landley.net>2013-02-03 17:04:36 -0600
commitaf0011995826b635658e29b107d33cf9ee7cdd42 (patch)
tree75ff2e6df4946813bfd98bad30cafc65d1c6738d /toys/other
parent22791083dab2de2b22154dd4e0e593ff6c48e08b (diff)
downloadtoybox-af0011995826b635658e29b107d33cf9ee7cdd42.tar.gz
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.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/losetup.c5
1 files changed, 3 insertions, 2 deletions
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;
}