diff options
author | Karel Zak | 2010-04-08 15:01:28 +0200 |
---|---|---|
committer | Karel Zak | 2010-06-03 15:20:12 +0200 |
commit | 3ef87248bf6567651af96bf49a77f177a4a29621 (patch) | |
tree | 84dfdec1307be01df4797d88682a5fb97a3d9123 /shlibs/mount/src/fs.c | |
parent | libmount: add new debug messages (diff) | |
download | kernel-qcow2-util-linux-3ef87248bf6567651af96bf49a77f177a4a29621.tar.gz kernel-qcow2-util-linux-3ef87248bf6567651af96bf49a77f177a4a29621.tar.xz kernel-qcow2-util-linux-3ef87248bf6567651af96bf49a77f177a4a29621.zip |
libmount: fix mnt_fs_match_source()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/fs.c')
-rw-r--r-- | shlibs/mount/src/fs.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index aa38998b9..d0fadc985 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -537,7 +537,6 @@ int mnt_fs_match_target(mnt_fs *fs, const char *target, mnt_cache *cache) */ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) { - int rc = 0; char *cn; const char *src, *t, *v; @@ -545,10 +544,11 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) return 0; /* 1) native paths/tags */ - rc = !strcmp(source, fs->source); - if (rc || !cache) - return rc; + if (!strcmp(source, fs->source)) + return 1; + if (!cache) + return 0; if (fs->flags & (MNT_FS_NET | MNT_FS_PSEUDO)) return 0; @@ -558,19 +558,17 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) /* 2) canonicalized and native */ src = mnt_fs_get_srcpath(fs); - if (src) - rc = !strcmp(cn, src); + if (src && !strcmp(cn, src)) + return 1; /* 3) canonicalized and canonicalized */ - if (src && !rc) { + if (src) { src = mnt_resolve_path(src, cache); - rc = !strcmp(cn, src); + if (src && !strcmp(cn, src)) + return 1; } - if (src && !rc) - /* fs->source is path and does not match with @source */ - return 0; - - if (mnt_fs_get_tag(fs, &t, &v)) + if (src || mnt_fs_get_tag(fs, &t, &v)) + /* src path does not match and tag is not defined */ return 0; /* read @source's tags to the cache */ @@ -590,10 +588,10 @@ int mnt_fs_match_source(mnt_fs *fs, const char *source, mnt_cache *cache) } /* 4) has the @source a tag that matches with tag from @fs ? */ - if (!mnt_cache_device_has_tag(cache, cn, t, v)) - return 0; + if (mnt_cache_device_has_tag(cache, cn, t, v)) + return 1; - return 1; + return 0; } /** |