summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/fs.c
diff options
context:
space:
mode:
authorKarel Zak2010-08-05 12:35:54 +0200
committerKarel Zak2011-01-03 12:28:40 +0100
commitbe1a5180596aa3a413e9c8047d0d25f4704756ef (patch)
tree747ea4dc2ee4176084ae076a815381bdd293ff72 /shlibs/mount/src/fs.c
parentfindmnt: add support for fs-root (subvolumes and bind mounts) (diff)
downloadkernel-qcow2-util-linux-be1a5180596aa3a413e9c8047d0d25f4704756ef.tar.gz
kernel-qcow2-util-linux-be1a5180596aa3a413e9c8047d0d25f4704756ef.tar.xz
kernel-qcow2-util-linux-be1a5180596aa3a413e9c8047d0d25f4704756ef.zip
libmount: correctly use "none" values
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/fs.c')
-rw-r--r--shlibs/mount/src/fs.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c
index 7fc5e8825..b0de9eaef 100644
--- a/shlibs/mount/src/fs.c
+++ b/shlibs/mount/src/fs.c
@@ -193,10 +193,10 @@ int __mnt_fs_set_source(mnt_fs *fs, char *source)
{
assert(fs);
- if (!source)
- return -1;
+ if (source && !strcmp(source, "none"))
+ source = NULL;
- if (strchr(source, '=')) {
+ if (source && strchr(source, '=')) {
char *name, *val;
if (blkid_parse_tag_string(source, &name, &val) != 0)
@@ -401,20 +401,23 @@ const char *mnt_fs_get_optstr(mnt_fs *fs)
*/
int mnt_fs_set_optstr(mnt_fs *fs, const char *optstr)
{
- char *p, *v, *f;
+ char *p = NULL, *v = NULL, *f = NULL;
assert(fs);
- if (!fs || !optstr)
- return -1;
- if (mnt_split_optstr((char *) optstr, NULL, &v, &f, 0, 0))
+ if (!fs)
return -1;
- p = strdup(optstr);
- if (!p) {
- free(v);
- free(f);
- return -1;
+ if (optstr) {
+ if (mnt_split_optstr((char *) optstr, NULL, &v, &f, 0, 0))
+ return -1;
+
+ p = strdup(optstr);
+ if (!p) {
+ free(v);
+ free(f);
+ return -1;
+ }
}
free(fs->optstr);