提交 e18a80a3 编写于 作者: D Daniel P. Berrange

Use virFileFindResource to locate virtlockd daemon

Make the lock plugin use virFileFindResource to find the
virtlockd daemon path, so that it executes the in-builddir
daemon if run from source tree.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 57e5c3c2
......@@ -55,7 +55,7 @@ export LD_LIBRARY_PATH
export LIBVIRT_DRIVER_DIR="$b/src/.libs"
export LIBVIRT_LOCK_MANAGER_PLUGIN_DIR="$b/src/.libs"
export VIRTLOCKD_PATH="$b/src/virtlockd"
export VIRTLOCKD_PATH="$b/src"
export LIBVIRTD_PATH="$b/daemon"
# This is a cheap way to find some use-after-free and uninitialized
......
......@@ -81,22 +81,6 @@ struct _virLockManagerLockDaemonDriver {
static virLockManagerLockDaemonDriverPtr driver = NULL;
#define VIRTLOCKD_PATH SBINDIR "/virtlockd"
static const char *
virLockManagerLockDaemonFindDaemon(void)
{
const char *customDaemon = virGetEnvBlockSUID("VIRTLOCKD_PATH");
if (customDaemon)
return customDaemon;
if (virFileIsExecutable(VIRTLOCKD_PATH))
return VIRTLOCKD_PATH;
return NULL;
}
static int virLockManagerLockDaemonLoadConfig(const char *configFile)
{
virConfPtr conf;
......@@ -266,8 +250,13 @@ static virNetClientPtr virLockManagerLockDaemonConnectionNew(bool privileged,
if (!(lockdpath = virLockManagerLockDaemonPath(privileged)))
goto error;
if (!privileged)
daemonPath = virLockManagerLockDaemonFindDaemon();
if (!privileged &&
!(daemonPath = virFileFindResourceFull("virtlockd",
NULL, NULL,
"src",
SBINDIR,
"VIRTLOCKD_PATH")))
goto error;
if (!(client = virNetClientNewUNIX(lockdpath,
daemonPath != NULL,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册