From 93c4f825fdf773ba621b8a6b86b051c50449a622 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 15 Aug 2022 17:32:40 +0200 Subject: [PATCH] libmount: (context) use default options maps Signed-off-by: Karel Zak --- libmount/src/context.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libmount/src/context.c b/libmount/src/context.c index b73b329d41..8115ffc18f 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -1101,8 +1101,22 @@ struct libmnt_optlist *mnt_context_get_optlist(struct libmnt_context *cxt) { if (!cxt) return NULL; - - return cxt->optlist ? : (cxt->optlist = mnt_new_optlist()); + if (!cxt->optlist) { + cxt->optlist = mnt_new_optlist(); + if (!cxt->optlist) + return NULL; + if (mnt_optlist_register_map(cxt->optlist, + mnt_get_builtin_optmap(MNT_LINUX_MAP))) + goto fail; + if (mnt_optlist_register_map(cxt->optlist, + mnt_get_builtin_optmap(MNT_USERSPACE_MAP))) + goto fail; + } + + return cxt->optlist; +fail: + mnt_unref_optlist(cxt->optlist); + return NULL; } /** -- 2.47.3