]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mount: clear flags before options parsing
authorKarel Zak <kzak@redhat.com>
Thu, 23 Feb 2012 13:53:14 +0000 (14:53 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 23 Feb 2012 13:53:14 +0000 (14:53 +0100)
for example "mount -a" calls the mount options parser more than once

Signed-off-by: Karel Zak <kzak@redhat.com>
mount/mount.c

index 57c0f597764438dca296f3e068043a279c59331e..0b9acb96ae2e85f6c416b17cadc79ee915facb4a 100644 (file)
@@ -205,8 +205,7 @@ static const struct opt_map opt_map[] = {
   { NULL,      0, 0, 0         }
 };
 
-static int opt_nofail = 0;
-
+static int opt_nofail;
 static int invuser_flags;
 
 static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_sizelimit,
@@ -242,6 +241,12 @@ clear_string_opts(void) {
                *(m->valptr) = NULL;
 }
 
+static void
+clear_flags_opts(void) {
+       invuser_flags = 0;
+       opt_nofail = 0;
+}
+
 static int
 parse_string_opt(char *s) {
        struct string_opt_map *m;
@@ -545,6 +550,7 @@ parse_opt(char *opt, int *mask, int *inv_user, char **extra_opts) {
        *extra_opts = append_opt(*extra_opts, opt, NULL);
 }
 
+
 /* Take -o options list and compute 4th and 5th args to mount(2).  flags
    gets the standard options (indicated by bits) and extra_opts all the rest */
 static void
@@ -553,6 +559,7 @@ parse_opts (const char *options, int *flags, char **extra_opts) {
        *extra_opts = NULL;
 
        clear_string_opts();
+       clear_flags_opts();
 
        if (options != NULL) {
                char *opts = xstrdup(options);