umount: fix behaviour of -A and -R with --namespace
Load /proc/self/mountinfo from correct namespace. Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
c1e70afedf
commit
6e965d0f4a
|
@ -219,7 +219,13 @@ static int umount_one(struct libmnt_context *cxt, const char *spec)
|
|||
|
||||
static struct libmnt_table *new_mountinfo(struct libmnt_context *cxt)
|
||||
{
|
||||
struct libmnt_table *tb = mnt_new_table();
|
||||
struct libmnt_table *tb;
|
||||
struct libmnt_ns *ns_old = mnt_context_switch_target_ns(cxt);
|
||||
|
||||
if (!ns_old)
|
||||
err(MNT_EX_SYSERR, _("failed to switch namespace"));
|
||||
|
||||
tb = mnt_new_table();
|
||||
if (!tb)
|
||||
err(MNT_EX_SYSERR, _("libmount table allocation failed"));
|
||||
|
||||
|
@ -232,6 +238,9 @@ static struct libmnt_table *new_mountinfo(struct libmnt_context *cxt)
|
|||
tb = NULL;
|
||||
}
|
||||
|
||||
if (!mnt_context_switch_ns(cxt, ns_old))
|
||||
err(MNT_EX_SYSERR, _("failed to switch namespace"));
|
||||
|
||||
return tb;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue