summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-02-20 00:55:14 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-02-20 01:03:21 +0100
commit19b07a60b699f905adc94d389eaa02c8e9b763ec (patch)
treef6bd619ed25b70eaa787f13da43e1a99d1cab5f5
parent258b45cde4d48149e410012b06bf2071dbba21b4 (diff)
mount: Fix deleting noauto/bind option
After deleting an option, we have to let the loop continue from there instead of skipping another option.
-rw-r--r--utils/mount.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/utils/mount.c b/utils/mount.c
index 483b71fc..68fd6493 100644
--- a/utils/mount.c
+++ b/utils/mount.c
@@ -255,17 +255,26 @@ do_mount (struct fs *fs, int remount)
/* Remove the `noauto' and `bind' options, since they're for us not the
filesystem. */
- for (o = mntopts; o; o = argz_next (mntopts, mntopts_len, o))
+ for (o = mntopts; o; )
{
if (strcmp (o, MNTOPT_NOAUTO) == 0)
- argz_delete (&mntopts, &mntopts_len, o);
+ {
+ argz_delete (&mntopts, &mntopts_len, o);
+ if (!mntopts || o >= mntopts + mntopts_len)
+ break;
+ continue;
+ }
if (strcmp (o, "bind") == 0)
{
fs->mntent.mnt_type = strdup ("firmlink");
if (!fs->mntent.mnt_type)
error (3, ENOMEM, "failed to allocate memory");
argz_delete (&mntopts, &mntopts_len, o);
+ if (!mntopts || o >= mntopts + mntopts_len)
+ break;
+ continue;
}
+ o = argz_next (mntopts, mntopts_len, o);
}
ARGZ (append (&mntopts, &mntopts_len, options, options_len));