From: Karel Zak Date: Thu, 7 Oct 2010 06:58:00 +0000 (+0200) Subject: umount: use strtosize() for offset= X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eac8c7dac9441bd9cfb3b9e78519b3ea51caab0e;p=util-linux umount: use strtosize() for offset= Signed-off-by: Karel Zak --- diff --git a/mount/Makefile.am b/mount/Makefile.am index 83e1fcdd..235cceb0 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -33,7 +33,7 @@ mount_CFLAGS = $(SUID_CFLAGS) $(cflags_common) mount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) mount_LDADD = $(ldadd_common) -umount_SOURCES = umount.c $(srcs_mount) +umount_SOURCES = umount.c $(srcs_mount) $(top_srcdir)/lib/strtosize.c umount_CFLAGS = $(SUID_CFLAGS) $(cflags_common) umount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) umount_LDADD = $(ldadd_common) diff --git a/mount/umount.c b/mount/umount.c index 0ad7c5f9..49741a51 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -20,6 +20,7 @@ #include "fstab.h" #include "env.h" #include "nls.h" +#include "strtosize.h" #if defined(MNT_FORCE) /* Interesting ... it seems libc knows about MNT_FORCE and presumably @@ -463,7 +464,7 @@ get_value(const char *list, const char *s) { static int is_valid_loop(struct mntentchn *mc, struct mntentchn *fs) { - unsigned long long offset = 0; + uintmax_t offset = 0; char *p; /* check if it begins with /dev/loop */ @@ -477,8 +478,11 @@ is_valid_loop(struct mntentchn *mc, struct mntentchn *fs) /* check for offset option in fstab */ p = get_value(fs->m.mnt_opts, "offset="); - if (p) - offset = strtoull(p, NULL, 10); + if (p && strtosize(p, &offset)) { + if (verbose > 1) + printf(_("failed to parse 'offset=%s' options\n"), p); + return 0; + } /* check association */ if (loopfile_used_with((char *) mc->m.mnt_fsname,