diff options
author | Karel Zak | 2011-08-01 13:33:04 +0200 |
---|---|---|
committer | Karel Zak | 2011-08-01 13:33:04 +0200 |
commit | d759ac366ab4eaa6e036f61ee4c9de10eec2a785 (patch) | |
tree | 2647e51a4a0d0d56f50df104ccc4170a8dff81e4 | |
parent | ionice: fix compiler warnings [-Wsign-compare] (diff) | |
download | kernel-qcow2-util-linux-d759ac366ab4eaa6e036f61ee4c9de10eec2a785.tar.gz kernel-qcow2-util-linux-d759ac366ab4eaa6e036f61ee4c9de10eec2a785.tar.xz kernel-qcow2-util-linux-d759ac366ab4eaa6e036f61ee4c9de10eec2a785.zip |
mount: fix compiler warnings [-Wsign-compare -Wunused-parameter]
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | mount/fstab.c | 4 | ||||
-rw-r--r-- | mount/lomount.c | 3 | ||||
-rw-r--r-- | mount/mount.c | 6 | ||||
-rw-r--r-- | mount/umount.c | 22 |
4 files changed, 18 insertions, 17 deletions
diff --git a/mount/fstab.c b/mount/fstab.c index 4fa26b446..2331a7d82 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -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; diff --git a/mount/lomount.c b/mount/lomount.c index 84dfb1275..ab542e27a 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -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; diff --git a/mount/mount.c b/mount/mount.c index 5278253bf..5066abc44 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -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, diff --git a/mount/umount.c b/mount/umount.c index 96c940e21..64f320c71 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -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 |