summaryrefslogtreecommitdiffstats
path: root/mount/umount.c
diff options
context:
space:
mode:
authorKarel Zak2010-10-07 08:58:00 +0200
committerKarel Zak2010-10-07 08:58:00 +0200
commiteac8c7dac9441bd9cfb3b9e78519b3ea51caab0e (patch)
tree57b75baa994b49890d02e59eaffa494a44f83cc6 /mount/umount.c
parentnamei: parse all path arguments when an optarg path will fail (diff)
downloadkernel-qcow2-util-linux-eac8c7dac9441bd9cfb3b9e78519b3ea51caab0e.tar.gz
kernel-qcow2-util-linux-eac8c7dac9441bd9cfb3b9e78519b3ea51caab0e.tar.xz
kernel-qcow2-util-linux-eac8c7dac9441bd9cfb3b9e78519b3ea51caab0e.zip
umount: use strtosize() for offset=
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/umount.c')
-rw-r--r--mount/umount.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mount/umount.c b/mount/umount.c
index 0ad7c5f98..49741a519 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,