]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: keep code more readable for analyzers [coverity scan]
authorKarel Zak <kzak@redhat.com>
Fri, 11 Mar 2011 12:57:14 +0000 (13:57 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Apr 2011 12:50:54 +0000 (14:50 +0200)
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>
shlibs/mount/src/optstr.c

index fd4a8610c58603e698a6ff971740b4d8c844f912..65dadf88c7d7061188740eff577229d6b1f7bd48 100644 (file)
@@ -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,