mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-30 21:47:18 +00:00
libvirtd: diagnose explicitly requested but missing conf file
Fixes test regression introduced in commit 8e2e4780
.
* daemon/libvirtd.c (daemonConfigLoad): Add argument.
(main): Update caller.
This commit is contained in:
parent
b0b85c454c
commit
a07c81c4d0
@ -1024,11 +1024,13 @@ daemonConfigFree(struct daemonConfig *data)
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
daemonConfigLoad(struct daemonConfig *data,
|
daemonConfigLoad(struct daemonConfig *data,
|
||||||
const char *filename)
|
const char *filename,
|
||||||
|
bool allow_missing)
|
||||||
{
|
{
|
||||||
virConfPtr conf;
|
virConfPtr conf;
|
||||||
|
|
||||||
if (access(filename, R_OK) == -1 &&
|
if (allow_missing &&
|
||||||
|
access(filename, R_OK) == -1 &&
|
||||||
errno == ENOENT)
|
errno == ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -1282,6 +1284,7 @@ int main(int argc, char **argv) {
|
|||||||
int ipsock = 0;
|
int ipsock = 0;
|
||||||
struct daemonConfig *config;
|
struct daemonConfig *config;
|
||||||
bool privileged = geteuid() == 0 ? true : false;
|
bool privileged = geteuid() == 0 ? true : false;
|
||||||
|
bool implicit_conf = false;
|
||||||
|
|
||||||
struct option opts[] = {
|
struct option opts[] = {
|
||||||
{ "verbose", no_argument, &verbose, 1},
|
{ "verbose", no_argument, &verbose, 1},
|
||||||
@ -1367,14 +1370,16 @@ int main(int argc, char **argv) {
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
/* No explicit config, so try and find a default one */
|
/* No explicit config, so try and find a default one */
|
||||||
if (remote_config_file == NULL &&
|
if (remote_config_file == NULL) {
|
||||||
daemonConfigFilePath(privileged,
|
implicit_conf = true;
|
||||||
&remote_config_file) < 0)
|
if (daemonConfigFilePath(privileged,
|
||||||
exit(EXIT_FAILURE);
|
&remote_config_file) < 0)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Read the config file if it exists*/
|
/* Read the config file if it exists*/
|
||||||
if (remote_config_file &&
|
if (remote_config_file &&
|
||||||
daemonConfigLoad(config, remote_config_file) < 0)
|
daemonConfigLoad(config, remote_config_file, implicit_conf) < 0)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
if (config->host_uuid &&
|
if (config->host_uuid &&
|
||||||
|
Loading…
Reference in New Issue
Block a user