From 41d6af28c3475987a085dc085c2348e22dc7fbdd Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 2 Mar 2012 11:23:34 +0100 Subject: [PATCH] libmount: cosmetic changes around "none" Signed-off-by: Karel Zak --- libmount/src/context.c | 6 +++++- libmount/src/context_mount.c | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libmount/src/context.c b/libmount/src/context.c index 1f30292023..f97dd36a67 100644 --- a/libmount/src/context.c +++ b/libmount/src/context.c @@ -1165,6 +1165,10 @@ int mnt_context_prepare_srcpath(struct libmnt_context *cxt) src = mnt_fs_get_source(cxt->fs); + if (!src && (cxt->mountflags & MS_PROPAGATION)) + /* mount --make-{shared,private,...} */ + return mnt_fs_set_source(cxt->fs, "none"); + /* ignore filesystems without source or filesystems * where the source is quasi-path (//foo/bar) */ @@ -1203,7 +1207,7 @@ int mnt_context_prepare_srcpath(struct libmnt_context *cxt) if ((cxt->mountflags & (MS_BIND | MS_MOVE | MS_PROPAGATION)) || mnt_fs_is_pseudofs(cxt->fs)) { - DBG(CXT, mnt_debug_h(cxt, "PROPAGATION/pseudo FS source: %s", path)); + DBG(CXT, mnt_debug_h(cxt, "BIND/MOVE/pseudo FS source: %s", path)); return rc; } diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 098243b72e..c56ffd4c19 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -453,9 +453,12 @@ static int do_mount(struct libmnt_context *cxt, const char *try_type) if (!target) return -EINVAL; - if (!src) + if (!src) { + /* unnecessary, should be already resolved in + * mnt_context_prepare_srcpath(), but for sure... */ + DBG(CXT, mnt_debug_h(cxt, "WARNING: source is NULL -- using \"none\"!")); src = "none"; - + } type = try_type ? : mnt_fs_get_fstype(cxt->fs); if (!(flags & MS_MGC_MSK)) -- 2.47.3