summaryrefslogtreecommitdiffstats
path: root/libmount
diff options
context:
space:
mode:
authorKarel Zak2015-02-16 14:17:54 +0100
committerKarel Zak2015-02-16 14:17:54 +0100
commit37290a53960dcd7f71e948576b9978bf685d9012 (patch)
tree2846a160de656ea320057e6e6e83ff01bd4ea139 /libmount
parentlibsmartcols: remove assert(arg) from public functions (diff)
downloadkernel-qcow2-util-linux-37290a53960dcd7f71e948576b9978bf685d9012.tar.gz
kernel-qcow2-util-linux-37290a53960dcd7f71e948576b9978bf685d9012.tar.xz
kernel-qcow2-util-linux-37290a53960dcd7f71e948576b9978bf685d9012.zip
libmount: remove assert(arg) from public functions
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount')
-rw-r--r--libmount/src/cache.c14
-rw-r--r--libmount/src/context.c55
-rw-r--r--libmount/src/fs.c60
-rw-r--r--libmount/src/lock.c3
-rw-r--r--libmount/src/optstr.c36
-rw-r--r--libmount/src/tab.c60
-rw-r--r--libmount/src/tab_diff.c3
-rw-r--r--libmount/src/tab_parse.c16
-rw-r--r--libmount/src/tab_update.c14
-rw-r--r--libmount/src/utils.c5
10 files changed, 28 insertions, 238 deletions
diff --git a/libmount/src/cache.c b/libmount/src/cache.c
index 1f940cc73..eb6146d1a 100644
--- a/libmount/src/cache.c
+++ b/libmount/src/cache.c
@@ -155,7 +155,6 @@ void mnt_unref_cache(struct libmnt_cache *cache)
int mnt_cache_set_targets(struct libmnt_cache *cache,
struct libmnt_table *mtab)
{
- assert(cache);
if (!cache)
return -EINVAL;
@@ -242,9 +241,6 @@ static const char *cache_find_path(struct libmnt_cache *cache, const char *path)
{
size_t i;
- assert(cache);
- assert(path);
-
if (!cache || !path)
return NULL;
@@ -267,10 +263,6 @@ static const char *cache_find_tag(struct libmnt_cache *cache,
size_t i;
size_t tksz;
- assert(cache);
- assert(token);
- assert(value);
-
if (!cache || !token || !value)
return NULL;
@@ -326,9 +318,6 @@ int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname)
const char *tags[] = { "LABEL", "UUID", "TYPE", "PARTUUID", "PARTLABEL" };
const char *blktags[] = { "LABEL", "UUID", "TYPE", "PART_ENTRY_UUID", "PART_ENTRY_NAME" };
- assert(cache);
- assert(devname);
-
if (!cache || !devname)
return -EINVAL;
@@ -675,9 +664,6 @@ char *mnt_resolve_tag(const char *token, const char *value,
{
char *p = NULL;
- assert(token);
- assert(value);
-
/*DBG(CACHE, ul_debugobj(cache, "resolving tag token=%s value=%s",
token, value));*/
diff --git a/libmount/src/context.c b/libmount/src/context.c
index d9391dd6b..8d19dc289 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -191,7 +191,6 @@ int mnt_reset_context(struct libmnt_context *cxt)
*/
int mnt_context_reset_status(struct libmnt_context *cxt)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
@@ -323,7 +322,6 @@ int mnt_context_is_restricted(struct libmnt_context *cxt)
*/
int mnt_context_set_optsmode(struct libmnt_context *cxt, int mode)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
cxt->optsmode = mode;
@@ -339,7 +337,6 @@ int mnt_context_set_optsmode(struct libmnt_context *cxt, int mode)
int mnt_context_get_optsmode(struct libmnt_context *cxt)
{
- assert(cxt);
return cxt->optsmode;
}
@@ -721,7 +718,6 @@ int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs)
*/
struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt)
{
- assert(cxt);
if (!cxt)
return NULL;
if (!cxt->fs)
@@ -737,7 +733,6 @@ struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt)
*/
void *mnt_context_get_fs_userdata(struct libmnt_context *cxt)
{
- assert(cxt);
return cxt->fs ? mnt_fs_get_userdata(cxt->fs) : NULL;
}
@@ -749,7 +744,6 @@ void *mnt_context_get_fs_userdata(struct libmnt_context *cxt)
*/
void *mnt_context_get_fstab_userdata(struct libmnt_context *cxt)
{
- assert(cxt);
return cxt->fstab ? mnt_table_get_userdata(cxt->fstab) : NULL;
}
@@ -761,7 +755,6 @@ void *mnt_context_get_fstab_userdata(struct libmnt_context *cxt)
*/
void *mnt_context_get_mtab_userdata(struct libmnt_context *cxt)
{
- assert(cxt);
return cxt->mtab ? mnt_table_get_userdata(cxt->mtab) : NULL;
}
@@ -779,7 +772,6 @@ void *mnt_context_get_mtab_userdata(struct libmnt_context *cxt)
*/
int mnt_context_set_source(struct libmnt_context *cxt, const char *source)
{
- assert(cxt);
return mnt_fs_set_source(mnt_context_get_fs(cxt), source);
}
@@ -791,7 +783,6 @@ int mnt_context_set_source(struct libmnt_context *cxt, const char *source)
*/
const char *mnt_context_get_source(struct libmnt_context *cxt)
{
- assert(cxt);
return mnt_fs_get_source(mnt_context_get_fs(cxt));
}
@@ -804,7 +795,6 @@ const char *mnt_context_get_source(struct libmnt_context *cxt)
*/
int mnt_context_set_target(struct libmnt_context *cxt, const char *target)
{
- assert(cxt);
return mnt_fs_set_target(mnt_context_get_fs(cxt), target);
}
@@ -816,7 +806,6 @@ int mnt_context_set_target(struct libmnt_context *cxt, const char *target)
*/
const char *mnt_context_get_target(struct libmnt_context *cxt)
{
- assert(cxt);
return mnt_fs_get_target(mnt_context_get_fs(cxt));
}
@@ -833,7 +822,6 @@ const char *mnt_context_get_target(struct libmnt_context *cxt)
*/
int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype)
{
- assert(cxt);
return mnt_fs_set_fstype(mnt_context_get_fs(cxt), fstype);
}
@@ -845,7 +833,6 @@ int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype)
*/
const char *mnt_context_get_fstype(struct libmnt_context *cxt)
{
- assert(cxt);
return mnt_fs_get_fstype(mnt_context_get_fs(cxt));
}
@@ -858,7 +845,6 @@ const char *mnt_context_get_fstype(struct libmnt_context *cxt)
*/
int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr)
{
- assert(cxt);
return mnt_fs_set_options(mnt_context_get_fs(cxt), optstr);
}
@@ -871,7 +857,6 @@ int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr)
*/
int mnt_context_append_options(struct libmnt_context *cxt, const char *optstr)
{
- assert(cxt);
return mnt_fs_append_options(mnt_context_get_fs(cxt), optstr);
}
@@ -890,7 +875,6 @@ int mnt_context_append_options(struct libmnt_context *cxt, const char *optstr)
*/
const char *mnt_context_get_options(struct libmnt_context *cxt)
{
- assert(cxt);
return mnt_fs_get_options(mnt_context_get_fs(cxt));
}
@@ -907,7 +891,6 @@ int mnt_context_set_fstype_pattern(struct libmnt_context *cxt, const char *patte
{
char *p = NULL;
- assert(cxt);
if (!cxt)
return -EINVAL;
if (pattern) {
@@ -933,7 +916,6 @@ int mnt_context_set_options_pattern(struct libmnt_context *cxt, const char *patt
{
char *p = NULL;
- assert(cxt);
if (!cxt)
return -EINVAL;
if (pattern) {
@@ -969,7 +951,6 @@ int mnt_context_set_options_pattern(struct libmnt_context *cxt, const char *patt
*/
int mnt_context_set_fstab(struct libmnt_context *cxt, struct libmnt_table *tb)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
@@ -991,7 +972,6 @@ int mnt_context_set_fstab(struct libmnt_context *cxt, struct libmnt_table *tb)
*/
int mnt_context_get_fstab(struct libmnt_context *cxt, struct libmnt_table **tb)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
if (!cxt->fstab) {
@@ -1025,7 +1005,6 @@ int mnt_context_get_fstab(struct libmnt_context *cxt, struct libmnt_table **tb)
*/
int mnt_context_get_mtab(struct libmnt_context *cxt, struct libmnt_table **tb)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
if (!cxt->mtab) {
@@ -1117,7 +1096,6 @@ int mnt_context_set_tabfilter(struct libmnt_context *cxt,
int (*fltr)(struct libmnt_fs *, void *),
void *data)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
@@ -1157,8 +1135,6 @@ int mnt_context_get_table(struct libmnt_context *cxt,
{
int rc;
- assert(cxt);
- assert(tb);
if (!cxt || !tb)
return -EINVAL;
@@ -1196,7 +1172,6 @@ int mnt_context_get_table(struct libmnt_context *cxt,
int mnt_context_set_tables_errcb(struct libmnt_context *cxt,
int (*cb)(struct libmnt_table *tb, const char *filename, int line))
{
- assert(cxt);
if (!cxt)
return -EINVAL;
@@ -1254,7 +1229,6 @@ int mnt_context_set_cache(struct libmnt_context *cxt, struct libmnt_cache *cache
*/
struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt)
{
- assert(cxt);
if (!cxt || mnt_context_is_nocanonicalize(cxt))
return NULL;
@@ -1281,7 +1255,6 @@ int mnt_context_set_passwd_cb(struct libmnt_context *cxt,
char *(*get)(struct libmnt_context *),
void (*release)(struct libmnt_context *, char *))
{
- assert(cxt);
if (!cxt)
return -EINVAL;
cxt->pwd_get_cb = get;
@@ -1311,7 +1284,6 @@ int mnt_context_set_passwd_cb(struct libmnt_context *cxt,
*/
struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt)
{
- assert(cxt);
/*
* DON'T call this function within libmount, it will always allocate
* the lock. The mnt_update_* functions are able to allocate the lock
@@ -1351,7 +1323,6 @@ struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt)
*/
int mnt_context_set_mflags(struct libmnt_context *cxt, unsigned long flags)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
@@ -1384,8 +1355,6 @@ int mnt_context_get_mflags(struct libmnt_context *cxt, unsigned long *flags)
int rc = 0;
struct list_head *p;
- assert(cxt);
- assert(flags);
if (!cxt || !flags)
return -EINVAL;
@@ -1443,8 +1412,6 @@ int mnt_context_get_user_mflags(struct libmnt_context *cxt, unsigned long *flags
{
int rc = 0;
- assert(cxt);
- assert(flags);
if (!cxt || !flags)
return -EINVAL;
@@ -1476,7 +1443,6 @@ int mnt_context_get_user_mflags(struct libmnt_context *cxt, unsigned long *flags
*/
int mnt_context_set_mountdata(struct libmnt_context *cxt, void *data)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
cxt->mountdata = data;
@@ -2037,10 +2003,7 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
const char *src = NULL, *tgt = NULL;
unsigned long mflags = 0;
- assert(cxt);
- assert(cxt->fs);
-
- if (!cxt)
+ if (!cxt || !cxt->fs)
return -EINVAL;
if (mnt_context_tab_applied(cxt)) /* already applied */
@@ -2138,7 +2101,6 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
*/
int mnt_context_tab_applied(struct libmnt_context *cxt)
{
- assert(cxt);
return cxt->flags & MNT_FL_TAB_APPLIED;
}
@@ -2149,9 +2111,6 @@ int mnt_context_tab_applied(struct libmnt_context *cxt)
*/
int mnt_context_propagation_only(struct libmnt_context *cxt)
{
- assert(cxt);
- assert(cxt->fs);
-
if (cxt->action != MNT_ACT_MOUNT)
return 0;
@@ -2180,7 +2139,6 @@ int mnt_context_propagation_only(struct libmnt_context *cxt)
*/
int mnt_context_get_status(struct libmnt_context *cxt)
{
- assert(cxt);
return !cxt->syscall_status || !cxt->helper_exec_status;
}
@@ -2192,7 +2150,6 @@ int mnt_context_get_status(struct libmnt_context *cxt)
*/
int mnt_context_helper_executed(struct libmnt_context *cxt)
{
- assert(cxt);
return cxt->helper_exec_status != 1;
}
@@ -2205,7 +2162,6 @@ int mnt_context_helper_executed(struct libmnt_context *cxt)
*/
int mnt_context_get_helper_status(struct libmnt_context *cxt)
{
- assert(cxt);
return cxt->helper_status;
}
@@ -2217,7 +2173,6 @@ int mnt_context_get_helper_status(struct libmnt_context *cxt)
*/
int mnt_context_syscall_called(struct libmnt_context *cxt)
{
- assert(cxt);
return cxt->syscall_status != 1;
}
@@ -2232,7 +2187,6 @@ int mnt_context_syscall_called(struct libmnt_context *cxt)
*/
int mnt_context_get_syscall_errno(struct libmnt_context *cxt)
{
- assert(cxt);
if (cxt->syscall_status < 0)
return -cxt->syscall_status;
return 0;
@@ -2252,7 +2206,6 @@ int mnt_context_get_syscall_errno(struct libmnt_context *cxt)
*/
int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status)
{
- assert(cxt);
if (!cxt)
return -EINVAL;
@@ -2301,7 +2254,8 @@ int mnt_context_init_helper(struct libmnt_context *cxt, int action,
{
int rc;
- assert(cxt);
+ if (!cxt)
+ return -EINVAL;
rc = mnt_context_disable_helpers(cxt, TRUE);
if (!rc)
@@ -2354,7 +2308,6 @@ int mnt_context_is_fs_mounted(struct libmnt_context *cxt,
struct libmnt_table *mtab;
int rc;
- assert(cxt);
if (!cxt || !fs || !mounted)
return -EINVAL;
@@ -2370,7 +2323,6 @@ static int mnt_context_add_child(struct libmnt_context *cxt, pid_t pid)
{
pid_t *pids;
- assert(cxt);
if (!cxt)
return -EINVAL;
@@ -2424,7 +2376,6 @@ int mnt_context_wait_for_children(struct libmnt_context *cxt,
{
int i;
- assert(cxt);
if (!cxt)
return -EINVAL;
diff --git a/libmount/src/fs.c b/libmount/src/fs.c
index 2cd01a9f5..e3b4eee0e 100644
--- a/libmount/src/fs.c
+++ b/libmount/src/fs.c
@@ -297,8 +297,6 @@ err:
*/
void *mnt_fs_get_userdata(struct libmnt_fs *fs)
{
- assert(fs);
-
if (!fs)
return NULL;
@@ -317,7 +315,6 @@ void *mnt_fs_get_userdata(struct libmnt_fs *fs)
*/
int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data)
{
- assert(fs);
if (!fs)
return -EINVAL;
@@ -341,7 +338,6 @@ int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data)
*/
const char *mnt_fs_get_srcpath(struct libmnt_fs *fs)
{
- assert(fs);
if (!fs)
return NULL;
@@ -360,7 +356,6 @@ const char *mnt_fs_get_srcpath(struct libmnt_fs *fs)
*/
const char *mnt_fs_get_source(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->source : NULL;
}
@@ -407,7 +402,6 @@ int mnt_fs_set_source(struct libmnt_fs *fs, const char *source)
char *p = NULL;
int rc;
- assert(fs);
if (!fs)
return -EINVAL;
@@ -437,7 +431,6 @@ int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path)
{
const char *p;
- assert(fs);
if (!fs)
return 0;
@@ -464,7 +457,6 @@ int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path)
*/
int mnt_fs_streq_target(struct libmnt_fs *fs, const char *path)
{
- assert(fs);
return fs && streq_except_trailing_slash(mnt_fs_get_target(fs), path);
}
@@ -503,7 +495,6 @@ int mnt_fs_streq_target(struct libmnt_fs *fs, const char *path)
*/
int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name, const char **value)
{
- assert(fs);
if (fs == NULL || !fs->tagname)
return -EINVAL;
if (name)
@@ -521,7 +512,6 @@ int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name, const char **value)
*/
const char *mnt_fs_get_target(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->target : NULL;
}
@@ -538,7 +528,6 @@ int mnt_fs_set_target(struct libmnt_fs *fs, const char *target)
{
char *p = NULL;
- assert(fs);
if (!fs)
return -EINVAL;
if (target) {
@@ -570,7 +559,6 @@ static int mnt_fs_get_flags(struct libmnt_fs *fs)
*/
int mnt_fs_get_propagation(struct libmnt_fs *fs, unsigned long *flags)
{
- assert(fs);
if (!fs || !flags)
return -EINVAL;
@@ -612,7 +600,6 @@ int mnt_fs_is_kernel(struct libmnt_fs *fs)
*/
int mnt_fs_is_swaparea(struct libmnt_fs *fs)
{
- assert(fs);
return mnt_fs_get_flags(fs) & MNT_FS_SWAP;
}
@@ -624,7 +611,6 @@ int mnt_fs_is_swaparea(struct libmnt_fs *fs)
*/
int mnt_fs_is_pseudofs(struct libmnt_fs *fs)
{
- assert(fs);
return mnt_fs_get_flags(fs) & MNT_FS_PSEUDO;
}
@@ -636,7 +622,6 @@ int mnt_fs_is_pseudofs(struct libmnt_fs *fs)
*/
int mnt_fs_is_netfs(struct libmnt_fs *fs)
{
- assert(fs);
return mnt_fs_get_flags(fs) & MNT_FS_NET;
}
@@ -648,7 +633,6 @@ int mnt_fs_is_netfs(struct libmnt_fs *fs)
*/
const char *mnt_fs_get_fstype(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->fstype : NULL;
}
@@ -690,7 +674,6 @@ int mnt_fs_set_fstype(struct libmnt_fs *fs, const char *fstype)
{
char *p = NULL;
- assert(fs);
if (!fs)
return -EINVAL;
if (fstype) {
@@ -768,7 +751,9 @@ char *mnt_fs_strdup_options(struct libmnt_fs *fs)
{
char *res;
- assert(fs);
+ if (!fs)
+ return NULL;
+
errno = 0;
if (fs->optstr)
return strdup(fs->optstr);
@@ -793,7 +778,6 @@ char *mnt_fs_strdup_options(struct libmnt_fs *fs)
*/
const char *mnt_fs_get_options(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->optstr : NULL;
}
@@ -806,7 +790,6 @@ const char *mnt_fs_get_options(struct libmnt_fs *fs)
*/
const char *mnt_fs_get_optional_fields(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->opt_fields : NULL;
}
@@ -824,7 +807,6 @@ int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr)
{
char *v = NULL, *f = NULL, *u = NULL, *n = NULL;
- assert(fs);
if (!fs)
return -EINVAL;
if (optstr) {
@@ -870,7 +852,6 @@ int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr)
char *v = NULL, *f = NULL, *u = NULL;
int rc;
- assert(fs);
if (!fs)
return -EINVAL;
if (!optstr)
@@ -913,7 +894,6 @@ int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr)
char *v = NULL, *f = NULL, *u = NULL;
int rc;
- assert(fs);
if (!fs)
return -EINVAL;
if (!optstr)
@@ -947,7 +927,6 @@ int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr)
*/
const char *mnt_fs_get_fs_options(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->fs_optstr : NULL;
}
@@ -959,7 +938,6 @@ const char *mnt_fs_get_fs_options(struct libmnt_fs *fs)
*/
const char *mnt_fs_get_vfs_options(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->vfs_optstr : NULL;
}
@@ -971,7 +949,6 @@ const char *mnt_fs_get_vfs_options(struct libmnt_fs *fs)
*/
const char *mnt_fs_get_user_options(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->user_optstr : NULL;
}
@@ -983,7 +960,6 @@ const char *mnt_fs_get_user_options(struct libmnt_fs *fs)
*/
const char *mnt_fs_get_attributes(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->attrs : NULL;
}
@@ -1006,7 +982,6 @@ int mnt_fs_set_attributes(struct libmnt_fs *fs, const char *optstr)
{
char *p = NULL;
- assert(fs);
if (!fs)
return -EINVAL;
if (optstr) {
@@ -1049,7 +1024,6 @@ int mnt_fs_append_attributes(struct libmnt_fs *fs, const char *optstr)
*/
int mnt_fs_prepend_attributes(struct libmnt_fs *fs, const char *optstr)
{
- assert(fs);
if (!fs)
return -EINVAL;
if (!optstr)
@@ -1066,7 +1040,6 @@ int mnt_fs_prepend_attributes(struct libmnt_fs *fs, const char *optstr)
*/
int mnt_fs_get_freq(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->freq : 0;
}
@@ -1079,7 +1052,6 @@ int mnt_fs_get_freq(struct libmnt_fs *fs)
*/
int mnt_fs_set_freq(struct libmnt_fs *fs, int freq)
{
- assert(fs);
if (!fs)
return -EINVAL;
fs->freq = freq;
@@ -1094,7 +1066,6 @@ int mnt_fs_set_freq(struct libmnt_fs *fs, int freq)
*/
int mnt_fs_get_passno(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->passno: 0;
}
@@ -1107,7 +1078,6 @@ int mnt_fs_get_passno(struct libmnt_fs *fs)
*/
int mnt_fs_set_passno(struct libmnt_fs *fs, int passno)
{
- assert(fs);
if (!fs)
return -EINVAL;
fs->passno = passno;
@@ -1122,7 +1092,6 @@ int mnt_fs_set_passno(struct libmnt_fs *fs, int passno)
*/
const char *mnt_fs_get_root(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->root : NULL;
}
@@ -1137,7 +1106,6 @@ int mnt_fs_set_root(struct libmnt_fs *fs, const char *root)
{
char *p = NULL;
- assert(fs);
if (!fs)
return -EINVAL;
if (root) {
@@ -1158,7 +1126,6 @@ int mnt_fs_set_root(struct libmnt_fs *fs, const char *root)
*/
const char *mnt_fs_get_swaptype(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->swaptype : NULL;
}
@@ -1170,7 +1137,6 @@ const char *mnt_fs_get_swaptype(struct libmnt_fs *fs)
*/
off_t mnt_fs_get_size(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->size : 0;
}
@@ -1182,7 +1148,6 @@ off_t mnt_fs_get_size(struct libmnt_fs *fs)
*/
off_t mnt_fs_get_usedsize(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->usedsize : 0;
}
@@ -1194,7 +1159,6 @@ off_t mnt_fs_get_usedsize(struct libmnt_fs *fs)
*/
int mnt_fs_get_priority(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->priority : 0;
}
@@ -1206,7 +1170,6 @@ int mnt_fs_get_priority(struct libmnt_fs *fs)
*/
int mnt_fs_set_priority(struct libmnt_fs *fs, int prio)
{
- assert(fs);
if (!fs)
return -EINVAL;
fs->priority = prio;
@@ -1221,7 +1184,6 @@ int mnt_fs_set_priority(struct libmnt_fs *fs, int prio)
*/
const char *mnt_fs_get_bindsrc(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->bindsrc : NULL;
}
@@ -1236,7 +1198,6 @@ int mnt_fs_set_bindsrc(struct libmnt_fs *fs, const char *src)
{
char *p = NULL;
- assert(fs);
if (!fs)
return -EINVAL;
if (src) {
@@ -1257,7 +1218,6 @@ int mnt_fs_set_bindsrc(struct libmnt_fs *fs, const char *src)
*/
int mnt_fs_get_id(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->id : -EINVAL;
}
@@ -1269,7 +1229,6 @@ int mnt_fs_get_id(struct libmnt_fs *fs)
*/
int mnt_fs_get_parent_id(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->parent : -EINVAL;
}
@@ -1281,7 +1240,6 @@ int mnt_fs_get_parent_id(struct libmnt_fs *fs)
*/
dev_t mnt_fs_get_devno(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->devno : 0;
}
@@ -1293,7 +1251,6 @@ dev_t mnt_fs_get_devno(struct libmnt_fs *fs)
*/
pid_t mnt_fs_get_tid(struct libmnt_fs *fs)
{
- assert(fs);
return fs ? fs->tid : 0;
}
@@ -1311,7 +1268,6 @@ int mnt_fs_get_option(struct libmnt_fs *fs, const char *name,
{
char rc = 1;
- assert(fs);
if (!fs)
return -EINVAL;
if (fs->fs_optstr)
@@ -1337,7 +1293,6 @@ int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name,
{
char rc = 1;
- assert(fs);
if (!fs)
return -EINVAL;
if (fs->attrs)
@@ -1353,7 +1308,6 @@ int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name,
*/
const char *mnt_fs_get_comment(struct libmnt_fs *fs)
{
- assert(fs);
if (!fs)
return NULL;
return fs->comment;
@@ -1374,7 +1328,6 @@ int mnt_fs_set_comment(struct libmnt_fs *fs, const char *comm)
{
char *p = NULL;
- assert(fs);
if (!fs)
return -EINVAL;
if (comm) {
@@ -1399,7 +1352,6 @@ int mnt_fs_set_comment(struct libmnt_fs *fs, const char *comm)
*/
int mnt_fs_append_comment(struct libmnt_fs *fs, const char *comm)
{
- assert(fs);
if (!fs)
return -EINVAL;
@@ -1433,7 +1385,6 @@ int mnt_fs_match_target(struct libmnt_fs *fs, const char *target,
{
int rc = 0;
- assert(fs);
if (!fs || !target || !fs->target)
return 0;
@@ -1478,7 +1429,6 @@ int mnt_fs_match_source(struct libmnt_fs *fs, const char *source,
char *cn;
const char *src, *t, *v;
- assert(fs);
if (!fs)
return 0;
@@ -1552,7 +1502,6 @@ int mnt_fs_match_source(struct libmnt_fs *fs, const char *source,
*/
int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types)
{
- assert(fs);
return mnt_match_fstype(fs->fstype, types);
}
@@ -1568,7 +1517,6 @@ int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types)
*/
int mnt_fs_match_options(struct libmnt_fs *fs, const char *options)
{
- assert(fs);
return mnt_match_options(mnt_fs_get_options(fs), options);
}
@@ -1667,8 +1615,6 @@ int mnt_fs_to_mntent(struct libmnt_fs *fs, struct mntent **mnt)
int rc;
struct mntent *m;
- assert(fs);
- assert(mnt);
if (!fs || !mnt)
return -EINVAL;
diff --git a/libmount/src/lock.c b/libmount/src/lock.c
index 713b3e653..8fc971617 100644
--- a/libmount/src/lock.c
+++ b/libmount/src/lock.c
@@ -56,7 +56,8 @@ struct libmnt_lock *mnt_new_lock(const char *datafile, pid_t id)
char *lo = NULL, *ln = NULL;
size_t losz;
- assert(datafile);
+ if (!datafile)
+ return NULL;
/* for flock we use "foo.lock, for mtab "foo~"
*/
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
index b1ac254ac..a729695f1 100644
--- a/libmount/src/optstr.c
+++ b/libmount/src/optstr.c
@@ -127,7 +127,6 @@ static int mnt_optstr_locate_option(char *optstr, const char *name,
return 1;
assert(name);
- assert(optstr);
namesz = strlen(name);
@@ -218,15 +217,15 @@ static int __mnt_optstr_append_option(char **optstr,
* @name: value name
* @value: value
*
- * Returns: 0 on success or -1 in case of error. After an error the @optstr should
+ * Returns: 0 on success or <0 in case of error. After an error the @optstr should
* be unmodified.
*/
int mnt_optstr_append_option(char **optstr, const char *name, const char *value)
{
size_t vsz, nsz;
- assert(optstr);
-
+ if (!optstr)
+ return -EINVAL;
if (!name || !*name)
return 0;
@@ -242,7 +241,7 @@ int mnt_optstr_append_option(char **optstr, const char *name, const char *value)
* @name: value name
* @value: value
*
- * Returns: 0 on success or -1 in case of error. After an error the @optstr should
+ * Returns: 0 on success or <0 in case of error. After an error the @optstr should
* be unmodified.
*/
int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value)
@@ -250,8 +249,8 @@ int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value
int rc = 0;
char *tmp = *optstr;
- assert(optstr);
-
+ if (!optstr)
+ return -EINVAL;
if (!name || !*name)
return 0;
@@ -289,8 +288,8 @@ int mnt_optstr_get_option(const char *optstr, const char *name,
struct libmnt_optloc ol;
int rc;
- assert(optstr);
- assert(name);
+ if (!optstr || !name)
+ return -EINVAL;
mnt_init_optloc(&ol);
@@ -319,8 +318,8 @@ int mnt_optstr_deduplicate_option(char **optstr, const char *name)
int rc;
char *begin = NULL, *end = NULL, *opt;
- assert(optstr);
- assert(name);
+ if (!optstr || !name)
+ return -EINVAL;
opt = *optstr;
do {
@@ -435,10 +434,7 @@ int mnt_optstr_set_option(char **optstr, const char *name, const char *value)
char *nameend;
int rc = 1;
- assert(optstr);
- assert(name);
-
- if (!optstr)
+ if (!optstr || !name)
return -EINVAL;
mnt_init_optloc(&ol);
@@ -484,8 +480,8 @@ int mnt_optstr_remove_option(char **optstr, const char *name)
struct libmnt_optloc ol;
int rc;
- assert(optstr);
- assert(name);
+ if (!optstr || !name)
+ return -EINVAL;
mnt_init_optloc(&ol);
@@ -525,8 +521,6 @@ int mnt_split_optstr(const char *optstr, char **user, char **vfs,
size_t namesz, valsz;
struct libmnt_optmap const *maps[2];
- assert(optstr);
-
if (!optstr)
return -EINVAL;
@@ -671,8 +665,6 @@ int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
size_t namesz = 0, valsz = 0;
int nmaps = 0;
- assert(optstr);
-
if (!optstr || !flags || !map)
return -EINVAL;
@@ -741,8 +733,6 @@ int mnt_optstr_apply_flags(char **optstr, unsigned long flags,
unsigned long fl;
int rc = 0;
- assert(optstr);
-
if (!optstr || !map)
return -EINVAL;
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index a012eccca..cd20ad0b2 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -187,7 +187,6 @@ int mnt_table_get_nents(struct libmnt_table *tb)
*/
int mnt_table_is_empty(struct libmnt_table *tb)
{
- assert(tb);
return tb == NULL || list_empty(&tb->ents) ? 1 : 0;
}
@@ -202,7 +201,6 @@ int mnt_table_is_empty(struct libmnt_table *tb)
*/
int mnt_table_set_userdata(struct libmnt_table *tb, void *data)
{
- assert(tb);
if (!tb)
return -EINVAL;
@@ -218,7 +216,6 @@ int mnt_table_set_userdata(struct libmnt_table *tb, void *data)
*/
void *mnt_table_get_userdata(struct libmnt_table *tb)
{
- assert(tb);
return tb ? tb->userdata : NULL;
}
@@ -244,14 +241,13 @@ void *mnt_table_get_userdata(struct libmnt_table *tb)
* # this comments belongs to the first fs
* LABEL=foo /mnt/foo auto defaults 1 2
* # this comments belongs to the second fs
- * LABEL=bar /mnt/bar auto defaults 1 2
+ * LABEL=bar /mnt/bar auto defaults 1 2
* # tailing comment
* </programlisting>
* </informalexample>
*/
void mnt_table_enable_comments(struct libmnt_table *tb, int enable)
{
- assert(tb);
if (tb)
tb->comms = enable;
}
@@ -276,7 +272,6 @@ int mnt_table_with_comments(struct libmnt_table *tb)
*/
const char *mnt_table_get_intro_comment(struct libmnt_table *tb)
{
- assert(tb);
return tb ? tb->comm_intro : NULL;
}
@@ -293,7 +288,6 @@ int mnt_table_set_intro_comment(struct libmnt_table *tb, const char *comm)
{
char *p = NULL;
- assert(tb);
if (!tb)
return -EINVAL;
if (comm) {
@@ -317,7 +311,6 @@ int mnt_table_set_intro_comment(struct libmnt_table *tb, const char *comm)
*/
int mnt_table_append_intro_comment(struct libmnt_table *tb, const char *comm)
{
- assert(tb);
if (!tb)
return -EINVAL;
return append_string(&tb->comm_intro, comm);
@@ -331,7 +324,6 @@ int mnt_table_append_intro_comment(struct libmnt_table *tb, const char *comm)
*/
const char *mnt_table_get_trailing_comment(struct libmnt_table *tb)
{
- assert(tb);
return tb ? tb->comm_tail : NULL;
}
@@ -348,7 +340,6 @@ int mnt_table_set_trailing_comment(struct libmnt_table *tb, const char *comm)
{
char *p = NULL;
- assert(tb);
if (!tb)
return -EINVAL;
if (comm) {
@@ -372,7 +363,6 @@ int mnt_table_set_trailing_comment(struct libmnt_table *tb, const char *comm)
*/
int mnt_table_append_trailing_comment(struct libmnt_table *tb, const char *comm)
{
- assert(tb);
if (!tb)
return -EINVAL;
return append_string(&tb->comm_tail, comm);
@@ -400,7 +390,6 @@ int mnt_table_append_trailing_comment(struct libmnt_table *tb, const char *comm)
*/
int mnt_table_set_cache(struct libmnt_table *tb, struct libmnt_cache *mpc)
{
- assert(tb);
if (!tb)
return -EINVAL;
@@ -418,7 +407,6 @@ int mnt_table_set_cache(struct libmnt_table *tb, struct libmnt_cache *mpc)
*/
struct libmnt_cache *mnt_table_get_cache(struct libmnt_table *tb)
{
- assert(tb);
return tb ? tb->cache : NULL;
}
@@ -435,9 +423,6 @@ struct libmnt_cache *mnt_table_get_cache(struct libmnt_table *tb)
*/
int mnt_table_add_fs(struct libmnt_table *tb, struct libmnt_fs *fs)
{
- assert(tb);
- assert(fs);
-
if (!tb || !fs)
return -EINVAL;
@@ -463,9 +448,6 @@ int mnt_table_add_fs(struct libmnt_table *tb, struct libmnt_fs *fs)
*/
int mnt_table_remove_fs(struct libmnt_table *tb, struct libmnt_fs *fs)
{
- assert(tb);
- assert(fs);
-
if (!tb || !fs)
return -EINVAL;
@@ -501,9 +483,6 @@ int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root)
struct libmnt_fs *fs;
int root_id = 0;
- assert(tb);
- assert(root);
-
if (!tb || !root || !is_mountinfo(tb))
return -EINVAL;
@@ -612,10 +591,6 @@ int mnt_table_next_fs(struct libmnt_table *tb, struct libmnt_iter *itr, struct l
{
int rc = 1;
- assert(tb);
- assert(itr);
- assert(fs);
-
if (!tb || !itr || !fs)
return -EINVAL;
*fs = NULL;
@@ -639,9 +614,6 @@ int mnt_table_next_fs(struct libmnt_table *tb, struct libmnt_iter *itr, struct l
*/
int mnt_table_first_fs(struct libmnt_table *tb, struct libmnt_fs **fs)
{
- assert(tb);
- assert(fs);
-
if (!tb || !fs)
return -EINVAL;
if (list_empty(&tb->ents))
@@ -659,9 +631,6 @@ int mnt_table_first_fs(struct libmnt_table *tb, struct libmnt_fs **fs)
*/
int mnt_table_last_fs(struct libmnt_table *tb, struct libmnt_fs **fs)
{
- assert(tb);
- assert(fs);
-
if (!tb || !fs)
return -EINVAL;
if (list_empty(&tb->ents))
@@ -713,8 +682,6 @@ static int mnt_table_move_parent(struct libmnt_table *tb, int oldid, int newid)
struct libmnt_iter itr;
struct libmnt_fs *fs;
- assert(tb);
-
if (!tb)
return -EINVAL;
if (list_empty(&tb->ents))
@@ -757,9 +724,6 @@ int mnt_table_uniq_fs(struct libmnt_table *tb, int flags,
struct libmnt_fs *fs;
int direction = MNT_ITER_BACKWARD;
- assert(tb);
- assert(cmp);
-
if (!tb || !cmp)
return -EINVAL;
if (list_empty(&tb->ents))
@@ -812,10 +776,6 @@ int mnt_table_uniq_fs(struct libmnt_table *tb, int flags,
*/
int mnt_table_set_iter(struct libmnt_table *tb, struct libmnt_iter *itr, struct libmnt_fs *fs)
{
- assert(tb);
- assert(itr);
- assert(fs);
-
if (!tb || !itr || !fs)
return -EINVAL;
@@ -893,9 +853,6 @@ struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb, const char *pat
struct libmnt_fs *fs = NULL;
char *cn;
- assert(tb);
- assert(path);
-
if (!tb || !path || !*path)
return NULL;
if (direction != MNT_ITER_FORWARD && direction != MNT_ITER_BACKWARD)
@@ -969,7 +926,6 @@ struct libmnt_fs *mnt_table_find_srcpath(struct libmnt_table *tb, const char *pa
char *cn;
const char *p;
- assert(tb);
if (!tb || !path || !*path)
return NULL;
if (direction != MNT_ITER_FORWARD && direction != MNT_ITER_BACKWARD)
@@ -1076,10 +1032,6 @@ struct libmnt_fs *mnt_table_find_tag(struct libmnt_table *tb, const char *tag,
struct libmnt_iter itr;
struct libmnt_fs *fs = NULL;
- assert(tb);
- assert(tag);
- assert(val);
-
if (!tb || !tag || !*tag || !val)
return NULL;
if (direction != MNT_ITER_FORWARD && direction != MNT_ITER_BACKWARD)
@@ -1123,8 +1075,6 @@ struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb,
struct libmnt_fs *fs;
char *t = NULL, *v = NULL;
- assert(tb);
-
if (!tb)
return NULL;
if (direction != MNT_ITER_FORWARD && direction != MNT_ITER_BACKWARD)
@@ -1162,9 +1112,6 @@ struct libmnt_fs *mnt_table_find_pair(struct libmnt_table *tb, const char *sourc
struct libmnt_fs *fs = NULL;
struct libmnt_iter itr;
- assert(tb);
- assert(target);
-
if (!tb || !target || !*target || !source || !*source)
return NULL;
if (direction != MNT_ITER_FORWARD && direction != MNT_ITER_BACKWARD)
@@ -1335,7 +1282,7 @@ err:
}
/**
- * mnt_table_is_fs__mounted:
+ * mnt_table_is_fs_mounted:
* @tb: /proc/self/mountinfo file
* @fstab_fs: /etc/fstab entry
*
@@ -1365,9 +1312,6 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
int rc = 0;
dev_t devno = 0;
- assert(tb);
- assert(fstab_fs);
-
DBG(FS, ul_debugobj(fstab_fs, "is FS mounted? [target=%s]",
mnt_fs_get_target(fstab_fs)));
diff --git a/libmount/src/tab_diff.c b/libmount/src/tab_diff.c
index 1ebaffdfc..2d178d10f 100644
--- a/libmount/src/tab_diff.c
+++ b/libmount/src/tab_diff.c
@@ -99,9 +99,6 @@ int mnt_tabdiff_next_change(struct libmnt_tabdiff *df, struct libmnt_iter *itr,
int rc = 1;
struct tabdiff_entry *de = NULL;
- assert(df);
- assert(df);
-
if (!df || !itr)
return -EINVAL;
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index 0f87730ee..ca8a61883 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -676,9 +676,6 @@ int mnt_table_parse_file(struct libmnt_table *tb, const char *filename)
FILE *f;
int rc;
- assert(tb);
- assert(filename);
-
if (!filename || !tb)
return -EINVAL;
@@ -823,7 +820,6 @@ struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt)
struct libmnt_table *tb;
struct stat st;
- assert(filename);
if (!filename)
return NULL;
if (stat(filename, &st))
@@ -852,7 +848,9 @@ struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt)
*/
struct libmnt_table *mnt_new_table_from_file(const char *filename)
{
- assert(filename);
+ if (!filename)
+ return NULL;
+
return __mnt_new_table_from_file(filename, MNT_FMT_GUESS);
}
@@ -866,7 +864,6 @@ struct libmnt_table *mnt_new_table_from_dir(const char *dirname)
{
struct libmnt_table *tb;
- assert(dirname);
if (!dirname)
return NULL;
tb = mnt_new_table();
@@ -896,7 +893,6 @@ struct libmnt_table *mnt_new_table_from_dir(const char *dirname)
int mnt_table_set_parser_errcb(struct libmnt_table *tb,
int (*cb)(struct libmnt_table *tb, const char *filename, int line))
{
- assert(tb);
if (!tb)
return -EINVAL;
tb->errcb = cb;
@@ -911,7 +907,6 @@ int mnt_table_set_parser_fltrcb(struct libmnt_table *tb,
int (*cb)(struct libmnt_fs *, void *),
void *data)
{
- assert(tb);
if (!tb)
return -EINVAL;
@@ -934,8 +929,6 @@ int mnt_table_set_parser_fltrcb(struct libmnt_table *tb,
*/
int mnt_table_parse_swaps(struct libmnt_table *tb, const char *filename)
{
- assert(tb);
-
if (!tb)
return -EINVAL;
if (!filename) {
@@ -966,7 +959,6 @@ int mnt_table_parse_fstab(struct libmnt_table *tb, const char *filename)
struct stat st;
int rc = 0;
- assert(tb);
if (!tb)
return -EINVAL;
if (!filename)
@@ -1002,8 +994,6 @@ static struct libmnt_fs *mnt_table_merge_user_fs(struct libmnt_table *tb, struct
struct libmnt_iter itr;
const char *optstr, *src, *target, *root, *attrs;
- assert(tb);
- assert(uf);
if (!tb || !uf)
return NULL;
diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c
index 27b41abb0..40adba98a 100644
--- a/libmount/src/tab_update.c
+++ b/libmount/src/tab_update.c
@@ -86,7 +86,6 @@ int mnt_update_set_filename(struct libmnt_update *upd, const char *filename,
const char *path = NULL;
int rw = 0;
- assert(upd);
if (!upd)
return -EINVAL;
@@ -131,7 +130,6 @@ int mnt_update_set_filename(struct libmnt_update *upd, const char *filename,
*/
const char *mnt_update_get_filename(struct libmnt_update *upd)
{
- assert(upd);
return upd ? upd->filename : NULL;
}
@@ -144,7 +142,6 @@ const char *mnt_update_get_filename(struct libmnt_update *upd)
*/
int mnt_update_is_ready(struct libmnt_update *upd)
{
- assert(upd);
return upd ? upd->ready : FALSE;
}
@@ -162,9 +159,6 @@ int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags,
{
int rc;
- assert(upd);
- assert(target || fs);
-
if (!upd)
return -EINVAL;
if ((mountflags & MS_MOVE) && (!fs || !mnt_fs_get_srcpath(fs)))
@@ -229,7 +223,6 @@ int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags,
*/
struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd)
{
- assert(upd);
return upd ? upd->fs : NULL;
}
@@ -241,7 +234,6 @@ struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd)
*/
unsigned long mnt_update_get_mflags(struct libmnt_update *upd)
{
- assert(upd);
return upd ? upd->mountflags : 0;
}
@@ -256,7 +248,6 @@ int mnt_update_force_rdonly(struct libmnt_update *upd, int rdonly)
{
int rc = 0;
- assert(upd);
if (!upd || !upd->fs)
return -EINVAL;
@@ -454,9 +445,6 @@ static int fprintf_utab_fs(FILE *f, struct libmnt_fs *fs)
char *p;
int rc = 0;
- assert(fs);
- assert(f);
-
if (!fs || !f)
return -EINVAL;
@@ -514,7 +502,6 @@ static int update_table(struct libmnt_update *upd, struct libmnt_table *tb)
int rc, fd;
char *uq = NULL;
- assert(upd);
if (!tb || !upd->filename)
return -EINVAL;
@@ -839,7 +826,6 @@ int mnt_update_table(struct libmnt_update *upd, struct libmnt_lock *lc)
struct libmnt_lock *lc0 = lc;
int rc = -EINVAL;
- assert(upd);
if (!upd || !upd->filename)
return -EINVAL;
if (!upd->ready)
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index 02f9e109b..25c762fdd 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -298,8 +298,6 @@ int mnt_fstype_is_pseudofs(const char *type)
*/
int mnt_fstype_is_netfs(const char *type)
{
- assert(type);
-
if (strcmp(type, "cifs") == 0 ||
strcmp(type, "smbfs") == 0 ||
strncmp(type,"nfs", 3) == 0 ||
@@ -970,7 +968,8 @@ char *mnt_get_mountpoint(const char *path)
struct stat st;
dev_t dir, base;
- assert(path);
+ if (!path)
+ return NULL;
mnt = strdup(path);
if (!mnt)