From: Zbigniew Jędrzejewski-Szmek Date: Tue, 23 Apr 2019 21:52:15 +0000 (+0200) Subject: shared/mount-util: make sure utab is ignored in umount_recursive() X-Git-Tag: v243-rc1~493^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12218%2Fhead;p=thirdparty%2Fsystemd.git shared/mount-util: make sure utab is ignored in umount_recursive() See https://github.com/systemd/systemd/pull/12218#pullrequestreview-226029985. --- diff --git a/src/shared/libmount-util.h b/src/shared/libmount-util.h index 6e8e61ed6ca..7c3b855df52 100644 --- a/src/shared/libmount-util.h +++ b/src/shared/libmount-util.h @@ -29,10 +29,15 @@ static inline int libmount_parse( if (!table || !iter) return -ENOMEM; + /* If source or path are specified, we use on the functions which ignore utab. + * Only if both are empty, we use mnt_table_parse_mtab(). */ + if (source) r = mnt_table_parse_stream(table, source, path); + else if (path) + r = mnt_table_parse_file(table, path); else - r = mnt_table_parse_mtab(table, path); + r = mnt_table_parse_mtab(table, NULL); if (r < 0) return r; diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index 97cc7b44c57..d84f28250db 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -38,7 +38,7 @@ int umount_recursive(const char *prefix, int flags) { again = false; - r = libmount_parse(NULL, NULL, &table, &iter); + r = libmount_parse("/proc/self/mountinfo", NULL, &table, &iter); if (r < 0) return log_debug_errno(r, "Failed to parse /proc/self/mountinfo: %m");