First, fix use of uninitialized variable 'ret'. Then, actually use
the value it returned in its caller.
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
const char* path)
{
char *pathdirname = NULL;
- int ret;
+ int ret = 0;
FILE *pathfile = NULL;
if (hasmntopt(mntent, "create=dir")) {
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);
if (parse_mntopts(mntent->mnt_opts, &mntflags, &mntdata) < 0) {