assert(fs);
- if (source && !strcmp(source, "none")) {
- free(source);
- source = NULL;
-
- } else if (source && strchr(source, '=')) {
+ if (source && strchr(source, '=')) {
if (blkid_parse_tag_string(source, &t, &v) != 0)
return -1;
}
if (!fs)
return -EINVAL;
+
if (source) {
p = strdup(source);
if (!p)
* The 2nd, 3rd and 4th iterations are not performed when @tb cache is not
* set (see mnt_table_set_cache()).
*
- * Note that valid source path is NULL; the libmount uses NULL instead of
- * "none". The "none" is used in /proc/{mounts,self/mountninfo} for pseudo
- * filesystems.
+ * Note that NULL is a valid source path; it will be replaced with "none". The
+ * "none" is used in /proc/{mounts,self/mountinfo} for pseudo filesystems.
*
* Returns: a tab entry or NULL.
*/
p = mnt_fs_get_srcpath(fs);
- if (path == NULL && src == NULL)
+ if (path == NULL && (src == NULL || !strcmp(src, "none")))
return fs; /* source is "none" */
if (path && p && streq_except_trailing_slash(p, path))
return fs;
unmangle_string(fs->vfs_optstr);
unmangle_string(fstype);
unmangle_string(src);
-
- if (!strcmp(fs->fs_optstr, "none")) {
- free(fs->fs_optstr);
- fs->fs_optstr = NULL;
- } else
- unmangle_string(fs->fs_optstr);
+ unmangle_string(fs->fs_optstr);
rc = __mnt_fs_set_fstype_ptr(fs, fstype);
if (!rc) {