summaryrefslogtreecommitdiffstats
path: root/mount/mount.c
diff options
context:
space:
mode:
authorKarel Zak2012-02-23 14:53:14 +0100
committerKarel Zak2012-02-23 14:53:14 +0100
commit43bd19a56f028061db28adf51d21f8a48f6ed9b1 (patch)
treeec7ec4474a0236f881ff935407d85cae3cf3ae93 /mount/mount.c
parenttests: add wall to build-sys tests (diff)
downloadkernel-qcow2-util-linux-43bd19a56f028061db28adf51d21f8a48f6ed9b1.tar.gz
kernel-qcow2-util-linux-43bd19a56f028061db28adf51d21f8a48f6ed9b1.tar.xz
kernel-qcow2-util-linux-43bd19a56f028061db28adf51d21f8a48f6ed9b1.zip
mount: clear flags before options parsing
for example "mount -a" calls the mount options parser more than once Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/mount.c')
-rw-r--r--mount/mount.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/mount/mount.c b/mount/mount.c
index 57c0f5977..0b9acb96a 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -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);