Unverified Commit 373376b2 by Stéphane Graber Committed by GitHub

Merge pull request #2682 from brauner/2018-10-08/fix_config_parsing

parse: do not mask failed parse
parents 27ebf8a1 646e6c8b
...@@ -111,9 +111,11 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da ...@@ -111,9 +111,11 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
} }
on_error: on_error:
ret = lxc_strmunmap(buf, st.st_size); if (lxc_strmunmap(buf, st.st_size) < 0) {
if (ret < 0)
SYSERROR("Failed to unmap config file \"%s\"", file); SYSERROR("Failed to unmap config file \"%s\"", file);
if (ret == 0)
ret = -1;
}
saved_errno = errno; saved_errno = errno;
close(fd); close(fd);
......
...@@ -600,6 +600,12 @@ int main(int argc, char *argv[]) ...@@ -600,6 +600,12 @@ int main(int argc, char *argv[])
goto out; goto out;
} }
if (c->set_config_item(c, "lxc.notaconfigkey", "invalid")) {
fprintf(stderr, "%d: Managed to set \"lxc.notaconfigkey\"\n", __LINE__);
goto out;
}
printf("All get_item tests passed\n"); printf("All get_item tests passed\n");
fret = EXIT_SUCCESS; fret = EXIT_SUCCESS;
......
...@@ -778,6 +778,11 @@ int main(int argc, char *argv[]) ...@@ -778,6 +778,11 @@ int main(int argc, char *argv[])
goto non_test_error; goto non_test_error;
} }
if (c->set_config_item(c, "lxc.notaconfigkey", "invalid")) {
lxc_error("%s\n", "Managed to set to set invalid config item \"lxc.notaconfigkey\" to \"invalid\"");
return -1;
}
fret = EXIT_SUCCESS; fret = EXIT_SUCCESS;
non_test_error: non_test_error:
......
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