From cba392b661d3fcf92d50d0df7c8783e18bb992da Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 4 Aug 2015 13:21:42 +0200 Subject: libmount: cleanup assert() usage Signed-off-by: Karel Zak --- libmount/src/context_mount.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'libmount/src/context_mount.c') diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index 210f0f169..63cba216b 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -159,11 +159,8 @@ static int fix_optstr(struct libmnt_context *cxt) }; #endif assert(cxt); - assert(cxt->fs); assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); - if (!cxt) - return -EINVAL; if (!cxt->fs || (cxt->flags & MNT_FL_MOUNTOPTS_FIXED)) return 0; @@ -390,11 +387,8 @@ static int evaluate_permissions(struct libmnt_context *cxt) unsigned long u_flags = 0; assert(cxt); - assert(cxt->fs); assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); - if (!cxt) - return -EINVAL; if (!cxt->fs) return 0; @@ -816,7 +810,6 @@ static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern) assert(cxt); assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED)); - /* * Use the pattern as list of the filesystems */ @@ -861,11 +854,6 @@ int mnt_context_prepare_mount(struct libmnt_context *cxt) { int rc = -EINVAL; - assert(cxt); - assert(cxt->fs); - assert(cxt->helper_exec_status == 1); - assert(cxt->syscall_status == 1); - if (!cxt || !cxt->fs || mnt_fs_is_swaparea(cxt->fs)) return -EINVAL; if (!mnt_fs_get_source(cxt->fs) && !mnt_fs_get_target(cxt->fs)) @@ -873,6 +861,9 @@ int mnt_context_prepare_mount(struct libmnt_context *cxt) if (cxt->flags & MNT_FL_PREPARED) return 0; + assert(cxt->helper_exec_status == 1); + assert(cxt->syscall_status == 1); + cxt->action = MNT_ACT_MOUNT; DBG(CXT, ul_debugobj(cxt, "mount: preparing")); -- cgit v1.2.3-55-g7522