changeset 799:6b8cc11d517c

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.
author Rob Landley <rob@landley.net>
date Sun, 03 Feb 2013 17:04:36 -0600
parents 16bcabb8cf97
children 4ffb735aea59
files toys/other/losetup.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/toys/other/losetup.c	Thu Jan 31 04:13:07 2013 -0600
+++ b/toys/other/losetup.c	Sun Feb 03 17:04:36 2013 -0600
@@ -75,7 +75,7 @@
 
     // 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 @@
 
   // 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;
     }