diff options
author | Karel Zak | 2008-10-01 00:27:37 +0200 |
---|---|---|
committer | Karel Zak | 2008-10-01 00:34:52 +0200 |
commit | 7a451aa99547d67a64b3313ea906c71217e5c6f2 (patch) | |
tree | dfa76a026687b9bd6affb7d0addbb0fcdd2e3277 /mount/fstab.c | |
parent | losetup: missing EBUSY error hint message (diff) | |
download | kernel-qcow2-util-linux-7a451aa99547d67a64b3313ea906c71217e5c6f2.tar.gz kernel-qcow2-util-linux-7a451aa99547d67a64b3313ea906c71217e5c6f2.tar.xz kernel-qcow2-util-linux-7a451aa99547d67a64b3313ea906c71217e5c6f2.zip |
mount: mtab created multiple times with -a option
When /etc/mtab does not exist and mount is called with -a, for every
mount point that is mounted a root-fs record is added to mtab. This is
because get_mtab_info() sets the flag mtab_does_not_exist to 1 when it
doesn't find /etc/mtab. However, if it actually finds /etc/mtab, the
variable is not reset to 0. So on every subsequent call to
get_mtab_info() (as it is the case when mounting several mount points
with the -a option), mount will think that /etc/mtab does not exist,
even if it was created in the meantime by mount itself.
Reported-By: Jonas Kramer <jkramer@nex.scrapping.cc>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount/fstab.c')
-rw-r--r-- | mount/fstab.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mount/fstab.c b/mount/fstab.c index 895fd2ce2..8c62a9e25 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -30,9 +30,12 @@ static int var_mtab_is_a_symlink = 0; static void get_mtab_info(void) { - struct stat mtab_stat; - if (!have_mtab_info) { + struct stat mtab_stat; + + var_mtab_does_not_exist = 0; + var_mtab_is_a_symlink = 0; + if (lstat(_PATH_MOUNTED, &mtab_stat)) var_mtab_does_not_exist = 1; else if (S_ISLNK(mtab_stat.st_mode)) |