fstrim: make sure we use mnt_table_parse_fstab()

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2019-05-09 14:15:15 +02:00
parent 9717a162e0
commit e062fa7554
1 changed files with 9 additions and 3 deletions

View File

@ -237,10 +237,16 @@ static int fstrim_all(struct fstrim_control *ctl)
if (!itr)
err(MNT_EX_FAIL, _("failed to initialize libmount iterator"));
if (ctl->fstab)
filename = mnt_get_fstab_path();
if (ctl->fstab) {
tab = mnt_new_table();
if (tab && mnt_table_parse_fstab(tab, NULL) != 0) {
mnt_unref_table(tab);
tab = NULL;
}
} else
tab = mnt_new_table_from_file(filename);
tab = mnt_new_table_from_file(filename);
if (!tab)
err(MNT_EX_FAIL, _("failed to parse %s"), filename);