diff options
author | Karel Zak | 2011-09-29 17:48:03 +0200 |
---|---|---|
committer | Karel Zak | 2011-09-29 17:48:03 +0200 |
commit | fd1eb7a72977f5bd054e25a864207786512e26af (patch) | |
tree | f506bf57b9242bbe10909d2dd3bb208e591b7fa8 /libmount/src/context_umount.c | |
parent | ipcrm: fix wrong subject in error messages for -m, -q, -s id options (diff) | |
download | kernel-qcow2-util-linux-fd1eb7a72977f5bd054e25a864207786512e26af.tar.gz kernel-qcow2-util-linux-fd1eb7a72977f5bd054e25a864207786512e26af.tar.xz kernel-qcow2-util-linux-fd1eb7a72977f5bd054e25a864207786512e26af.zip |
libmount: add function to parse offsets/sizes
Diffstat (limited to 'libmount/src/context_umount.c')
-rw-r--r-- | libmount/src/context_umount.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index bc08affc0..e271845e2 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -127,17 +127,11 @@ static int mnt_loopdev_associated_fs(const char *devname, struct libmnt_fs *fs) /* check for offset option in @fs */ optstr = (char *) mnt_fs_get_user_options(fs); - if (optstr && !mnt_optstr_get_option(optstr, "offset=", &val, &valsz)) { - int rc; - - val = strndup(val, valsz); - if (!val) - return 0; - rc = strtosize(val, &offset); - free(val); - if (rc) - return 0; - } + + if (optstr && + mnt_optstr_get_option(optstr, "offset", &val, &valsz) == 0 && + mnt_parse_offset(val, valsz, &offset) != 0) + return 0; /* TODO: * if (mnt_loopdev_associated_file(devname, src, offset)) |