From: Karel Zak Date: Fri, 11 Mar 2011 12:57:14 +0000 (+0100) Subject: libmount: keep code more readable for analyzers [coverity scan] X-Git-Tag: v2.19.1-rc1~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=24bc6202865be720b19e0eb3802de163248bff1f;p=thirdparty%2Futil-linux.git 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 --- diff --git a/shlibs/mount/src/optstr.c b/shlibs/mount/src/optstr.c index fd4a8610c5..65dadf88c7 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,