summaryrefslogtreecommitdiffstats
path: root/shlibs/mount/src/optstr.c
diff options
context:
space:
mode:
authorKarel Zak2011-03-11 13:57:14 +0100
committerKarel Zak2011-03-11 13:57:14 +0100
commit1734f82c2435c35a9b575297a93942cf880b5913 (patch)
tree55f87a6817398cab6ddc2f107c4152fbbec758fb /shlibs/mount/src/optstr.c
parentlibblkid: fix typo in *_to_cpu() usage in raid detection [coverity scan] (diff)
downloadkernel-qcow2-util-linux-1734f82c2435c35a9b575297a93942cf880b5913.tar.gz
kernel-qcow2-util-linux-1734f82c2435c35a9b575297a93942cf880b5913.tar.xz
kernel-qcow2-util-linux-1734f82c2435c35a9b575297a93942cf880b5913.zip
libmount: keep code more readable for analyzers [coverity scan]
This is not a bug ('ent' is always non-NULL is 'm' is non-NULL), but let's keep static analyzes and humans who read the code happy. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/mount/src/optstr.c')
-rw-r--r--shlibs/mount/src/optstr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c
index 92abcdb1a..406afc4b7 100644
--- a/shlibs/mount/src/optstr.c
+++ b/shlibs/mount/src/optstr.c
@@ -476,19 +476,19 @@ int mnt_split_optstr(const char *optstr, char **user, char **vfs,
while(!mnt_optstr_next_option(&str, &name, &namesz, &val, &valsz)) {
int rc = 0;
- const struct libmnt_optmap *ent;
+ const struct libmnt_optmap *ent = NULL;
const struct libmnt_optmap *m =
mnt_optmap_get_entry(maps, 2, name, namesz, &ent);
if (ent && !ent->id)
continue; /* ignore undefined options (comments) */
- if (m && m == maps[0] && vfs) {
+ if (ent && m && m == maps[0] && vfs) {
if (ignore_vfs && (ent->mask & ignore_vfs))
continue;
rc = __mnt_optstr_append_option(vfs, name, namesz,
val, valsz);
- } else if (m && m == maps[1] && user) {
+ } else if (ent && m && m == maps[1] && user) {
if (ignore_user && (ent->mask & ignore_user))
continue;
rc = __mnt_optstr_append_option(user, name, namesz,