Commit f9419eab by Serge Hallyn Committed by Stéphane Graber

coverity: fix mount_entry_create_dir_file

First, fix use of uninitialized variable 'ret'. Then, actually use the value it returned in its caller. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent c95ff1a5
...@@ -2139,7 +2139,7 @@ static int mount_entry_create_dir_file(const struct mntent *mntent, ...@@ -2139,7 +2139,7 @@ static int mount_entry_create_dir_file(const struct mntent *mntent,
const char* path) const char* path)
{ {
char *pathdirname = NULL; char *pathdirname = NULL;
int ret; int ret = 0;
FILE *pathfile = NULL; FILE *pathfile = NULL;
if (hasmntopt(mntent, "create=dir")) { if (hasmntopt(mntent, "create=dir")) {
...@@ -2177,6 +2177,12 @@ static inline int mount_entry_on_generic(struct mntent *mntent, ...@@ -2177,6 +2177,12 @@ static inline int mount_entry_on_generic(struct mntent *mntent,
ret = mount_entry_create_dir_file(mntent, path); ret = mount_entry_create_dir_file(mntent, path);
if (ret < 0)
return optional ? 0 : -1;
if (ret < 0 && !optional)
return -1;
cull_mntent_opt(mntent); cull_mntent_opt(mntent);
if (parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata) < 0) { if (parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata) < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment