mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 02:51:16 +00:00
diagnose "libvirtd --config=no-such-file"
* qemud/qemud.c (remoteReadConfigFile): Don't return 0 (success) when the config file is unreadable or nonexistent Return -1, not 0, upon virConfReadFile failure. (main): If remote_config_file is not specified via --config(-f), use the default config file only if it exists. Otherwise, use /dev/null. * src/conf.c (virConfReadFile): Don't diagnose virFileReadAll failure, since it already does that.
This commit is contained in:
parent
1c947488f6
commit
6954d44e53
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
Mon Jan 12 18:55:16 +0100 2009 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
diagnose "libvirtd --config=no-such-file"
|
||||||
|
* qemud/qemud.c (remoteReadConfigFile): Don't return 0 (success)
|
||||||
|
when the config file is unreadable or nonexistent
|
||||||
|
Return -1, not 0, upon virConfReadFile failure.
|
||||||
|
(main): If remote_config_file is not specified via --config(-f),
|
||||||
|
use the default config file only if it exists. Otherwise,
|
||||||
|
use /dev/null.
|
||||||
|
* src/conf.c (virConfReadFile): Don't diagnose virFileReadAll
|
||||||
|
failure, since it already does that.
|
||||||
|
|
||||||
Mon Jan 12 18:55:15 +0100 2009 Jim Meyering <meyering@redhat.com>
|
Mon Jan 12 18:55:15 +0100 2009 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
fix non-srcdir build failure
|
fix non-srcdir build failure
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* qemud.c: daemon start of day, guest process & i/o management
|
* qemud.c: daemon start of day, guest process & i/o management
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
|
* Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
|
||||||
* Copyright (C) 2006 Daniel P. Berrange
|
* Copyright (C) 2006 Daniel P. Berrange
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -2116,13 +2116,8 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
|
|||||||
auth_unix_ro = REMOTE_AUTH_NONE;
|
auth_unix_ro = REMOTE_AUTH_NONE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Just check the file is readable before opening it, otherwise
|
|
||||||
* libvirt emits an error.
|
|
||||||
*/
|
|
||||||
if (access (filename, R_OK) == -1) return 0;
|
|
||||||
|
|
||||||
conf = virConfReadFile (filename);
|
conf = virConfReadFile (filename);
|
||||||
if (!conf) return 0;
|
if (!conf) return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First get all the logging settings and activate them
|
* First get all the logging settings and activate them
|
||||||
@ -2301,7 +2296,7 @@ int main(int argc, char **argv) {
|
|||||||
struct sigaction sig_action;
|
struct sigaction sig_action;
|
||||||
int sigpipe[2];
|
int sigpipe[2];
|
||||||
const char *pid_file = NULL;
|
const char *pid_file = NULL;
|
||||||
const char *remote_config_file = SYSCONF_DIR "/libvirt/libvirtd.conf";
|
const char *remote_config_file = NULL;
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
struct option opts[] = {
|
struct option opts[] = {
|
||||||
@ -2372,6 +2367,15 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (remote_config_file == NULL) {
|
||||||
|
static const char *default_config_file
|
||||||
|
= SYSCONF_DIR "/libvirt/libvirtd.conf";
|
||||||
|
remote_config_file =
|
||||||
|
(access(default_config_file, X_OK) == 0
|
||||||
|
? default_config_file
|
||||||
|
: "/dev/null");
|
||||||
|
}
|
||||||
|
|
||||||
if (godaemon) {
|
if (godaemon) {
|
||||||
if (qemudGoDaemon() < 0) {
|
if (qemudGoDaemon() < 0) {
|
||||||
VIR_ERROR(_("Failed to fork as daemon: %s"), strerror(errno));
|
VIR_ERROR(_("Failed to fork as daemon: %s"), strerror(errno));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* conf.c: parser for a subset of the Python encoded Xen configuration files
|
* conf.c: parser for a subset of the Python encoded Xen configuration files
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006, 2007, 2008 Red Hat, Inc.
|
* Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* See COPYING.LIB for the License of this software
|
* See COPYING.LIB for the License of this software
|
||||||
*
|
*
|
||||||
@ -712,7 +712,6 @@ virConfReadFile(const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((len = virFileReadAll(filename, MAX_CONFIG_FILE_SIZE, &content)) < 0) {
|
if ((len = virFileReadAll(filename, MAX_CONFIG_FILE_SIZE, &content)) < 0) {
|
||||||
virConfError(NULL, VIR_ERR_OPEN_FAILED, filename);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user