summaryrefslogtreecommitdiff
path: root/mount/umount.c
diff options
context:
space:
mode:
authorPetr Uzel <petr.uzel@suse.cz>2011-01-26 12:17:00 +0100
committerKarel Zak <kzak@redhat.com>2011-01-31 17:12:49 +0100
commit7897c815ba0319146a4fe41f12eaba802dd3b3ff (patch)
tree1d0e94a7a73a023e2dd9c0d95bca7180b2a129a4 /mount/umount.c
parent10a1c5ddf02e3b1508b8c44007f022f569638288 (diff)
downloadutil-linux-old-7897c815ba0319146a4fe41f12eaba802dd3b3ff.tar.gz
mount: fix parsing offset= followed by more options
mount does not parse parse offset= option if it is followed by other options. In umount, the parsing is done with the get_value() function. This patch moves get_value to fstab.c (with new name get_option_value()) and fixes mount to use the function. [kzak@redhat.com: - rename to get_option_value() - use fstab.c rather than sundries.c] Novell bugzilla: #666150 Reported-by: Ludwig Nussel <ludwig.nussel@suse.de> Signed-off-by: Petr Uzel <petr.uzel@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/umount.c')
-rw-r--r--mount/umount.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/mount/umount.c b/mount/umount.c
index 079aa337..468fb601 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -455,26 +455,6 @@ contains(const char *list, const char *s) {
return 0;
}
-/*
- * If list contains "user=peter" and we ask for "user=", return "peter"
- */
-static char *
-get_value(const char *list, const char *s) {
- const char *t;
- int n = strlen(s);
-
- while (list && *list) {
- if (strncmp(list, s, n) == 0) {
- s = t = list+n;
- while (*s && *s != ',')
- s++;
- return xstrndup(t, s-t);
- }
- while (*list && *list++ != ',') ;
- }
- return NULL;
-}
-
/* check if @mc contains a loop device which is associated
* with the @file in fs
*/
@@ -494,7 +474,7 @@ is_valid_loop(struct mntentchn *mc, struct mntentchn *fs)
return 0;
/* check for offset option in fstab */
- p = get_value(fs->m.mnt_opts, "offset=");
+ p = get_option_value(fs->m.mnt_opts, "offset=");
if (p && strtosize(p, &offset)) {
if (verbose > 1)
printf(_("failed to parse 'offset=%s' options\n"), p);
@@ -572,7 +552,8 @@ umount_file (char *arg) {
char *uhelper = NULL;
if (mc->m.mnt_opts)
- uhelper = get_value(mc->m.mnt_opts, "uhelper=");
+ uhelper = get_option_value(mc->m.mnt_opts,
+ "uhelper=");
if (uhelper) {
int status = 0;
if (check_special_umountprog(arg, arg,
@@ -641,7 +622,7 @@ umount_file (char *arg) {
options = mc->m.mnt_opts;
if (!options)
options = "";
- mtab_user = get_value(options, "user=");
+ mtab_user = get_option_value(options, "user=");
if (user && mtab_user && streq (user, mtab_user))
ok = 1;