]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: fix compiler warnings [-Wsign-compare -Wunused-parameter]
authorKarel Zak <kzak@redhat.com>
Mon, 1 Aug 2011 11:33:04 +0000 (13:33 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 1 Aug 2011 11:33:04 +0000 (13:33 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
mount/fstab.c
mount/lomount.c
mount/mount.c
mount/umount.c

index 4fa26b4468e3e746528ce4010f3b6163eae7304c..2331a7d82660be992d62810b39461764773e0c92 100644 (file)
@@ -580,7 +580,7 @@ handler (int sig) {
 }
 
 static void
-setlkw_timeout (int sig) {
+setlkw_timeout (int sig __attribute__ ((__unused__))) {
      /* nothing, fcntl will fail anyway */
 }
 
@@ -775,7 +775,7 @@ get_option(const char *optname, const char *src, size_t *len)
                return NULL;
 
        end = strchr(opt, ',');
-       sz = end ? end - opt : strlen(opt);
+       sz = end && end > opt ? (size_t) (end - opt) : strlen(opt);
 
        if (len)
                *len = sz;
index 84dfb127559f9cfb9f08ef34b4f01b2888253d39..ab542e27ad3b657c9c0a1a7f6da7488613fa33f1 100644 (file)
@@ -52,7 +52,8 @@ loop_info64_to_old(const struct loop_info64 *info64, struct loop_info *info)
         if (info->lo_device != info64->lo_device ||
             info->lo_rdevice != info64->lo_rdevice ||
             info->lo_inode != info64->lo_inode ||
-            info->lo_offset != info64->lo_offset)
+            info->lo_offset < 0 ||
+           (uint64_t) info->lo_offset != info64->lo_offset)
                 return -EOVERFLOW;
 
         return 0;
index 5278253bfcb8592e8857200e28c5768f8344f2a2..5066abc4423e95b7660904fb9d7e8d60dec297e2 100644 (file)
@@ -760,7 +760,7 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in
                res = snprintf(mountprog, sizeof(mountprog), "%s/mount.%s",
                               path, type);
                path = strtok(NULL, ":");
-               if (res >= sizeof(mountprog) || res < 0)
+               if (res < 0 || (size_t) res >= sizeof(mountprog))
                        continue;
 
                res = stat(mountprog, &statbuf);
@@ -1335,7 +1335,7 @@ loop_check(const char **spec, const char **type, int *flags,
 #ifdef HAVE_LIBMOUNT_MOUNT
 static void
 verbose_mount_info(const char *spec, const char *node, const char *type,
-                 const char *opts, int flags)
+                 const char *opts)
 {
        struct my_mntent mnt;
 
@@ -1674,7 +1674,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
 #ifdef HAVE_LIBMOUNT_MOUNT
       update_mtab_entry(flags);
       if (verbose)
-             verbose_mount_info(loop ? loopfile : spec, node, tp, mo, flags);
+             verbose_mount_info(loop ? loopfile : spec, node, tp, mo);
 #else
       if (!(mounttype & MS_PROPAGATION))
              update_mtab_entry(loop ? loopfile : spec,
index 96c940e213bd46d593c69d05ac93e2ab17224f6c..64f320c71b0f5ec1a4e6c6190bc186d22f23034b 100644 (file)
@@ -98,7 +98,7 @@ static int fake = 0;
  * returns: 0: no exec was done, 1: exec was done, status has result
  */
 static int
-check_special_umountprog(const char *spec, const char *node,
+check_special_umountprog(const char *node,
                         const char *type, int *status) {
        char umountprog[120];
        struct stat statbuf;
@@ -263,7 +263,7 @@ static const char *chdir_to_parent(const char *node, char **resbuf)
    on a non-fatal error.  We lock/unlock around each umount.  */
 static int
 umount_one (const char *spec, const char *node, const char *type,
-           const char *opts, struct mntentchn *mc) {
+           struct mntentchn *mc) {
        int umnt_err = 0;
        int isroot;
        int res = 0;
@@ -288,7 +288,7 @@ umount_one (const char *spec, const char *node, const char *type,
         * Call umount.TYPE for types that require a separate umount program.
         * All such special things must occur isolated in the types string.
         */
-       if (check_special_umountprog(spec, node, type, &status))
+       if (check_special_umountprog(node, type, &status))
                return status;
 
        block_signals(SIG_BLOCK);
@@ -455,13 +455,13 @@ umount_one_bw (const char *file, struct mntentchn *mc0) {
        mc = mc0;
        while (res && mc) {
                res = umount_one(mc->m.mnt_fsname, mc->m.mnt_dir,
-                                mc->m.mnt_type, mc->m.mnt_opts, mc);
+                                mc->m.mnt_type, mc);
                mc = getmntdirbackward(file, mc);
        }
        mc = mc0;
        while (res && mc) {
                res = umount_one(mc->m.mnt_fsname, mc->m.mnt_dir,
-                                mc->m.mnt_type, mc->m.mnt_opts, mc);
+                                mc->m.mnt_type, mc);
                mc = getmntdevbackward(file, mc);
        }
        return res;
@@ -484,7 +484,7 @@ umount_all (char *types, char *test_opts) {
          if (matching_type (mc->m.mnt_type, types)
              && matching_opts (mc->m.mnt_opts, test_opts)) {
               errors |= umount_one (mc->m.mnt_fsname, mc->m.mnt_dir,
-                                    mc->m.mnt_type, mc->m.mnt_opts, mc);
+                                    mc->m.mnt_type, mc);
          }
      }
 
@@ -577,7 +577,7 @@ is_valid_loop(struct mntentchn *mc, struct mntentchn *fs)
 /*
  * umount helper call based on {u,p}helper= mount option
  */
-static int check_helper_umountprog(const char *spec, const char *node,
+static int check_helper_umountprog(const char *node,
                                   const char *opts, const char *name,
                                   int *status)
 {
@@ -588,7 +588,7 @@ static int check_helper_umountprog(const char *spec, const char *node,
 
        helper = get_option_value(opts, name);
        if (helper)
-               return check_special_umountprog(spec, node, helper, status);
+               return check_special_umountprog(node, helper, status);
 
        return 0;
 }
@@ -665,7 +665,7 @@ try_loopdev:
                /*
                 * helper - umount helper (e.g. pam_mount)
                 */
-                if (check_helper_umountprog(arg, arg, mc->m.mnt_opts,
+                if (check_helper_umountprog(arg, mc->m.mnt_opts,
                                            "helper=", &status))
                        return status;
        }
@@ -680,7 +680,7 @@ try_loopdev:
                /*
                 * uhelper - unprivileged umount helper (e.g. HAL/udisks mounts)
                 */
-               if (check_helper_umountprog(arg, arg, mc->m.mnt_opts,
+               if (check_helper_umountprog(arg, mc->m.mnt_opts,
                                            "uhelper=", &status))
                        return status;
 
@@ -759,7 +759,7 @@ try_loopdev:
        if (mc)
                return umount_one_bw (file, mc);
        else
-               return umount_one (arg, arg, arg, arg, NULL);
+               return umount_one (arg, arg, arg, NULL);
 }
 
 int