From: Vaclav Dolezal Date: Tue, 24 Apr 2018 16:05:04 +0000 (+0200) Subject: umount: fix behaviour of -A and -R with --namespace X-Git-Tag: v2.33-rc1~210 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e965d0f4a1e1b9c6da92d51e1dafa9571467388;p=thirdparty%2Futil-linux.git umount: fix behaviour of -A and -R with --namespace Load /proc/self/mountinfo from correct namespace. Signed-off-by: Vaclav Dolezal Signed-off-by: Karel Zak --- diff --git a/sys-utils/umount.c b/sys-utils/umount.c index 244080598b..5478c55b87 100644 --- a/sys-utils/umount.c +++ b/sys-utils/umount.c @@ -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; }