mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemusecuritytest: Call real virFileExists in mock
When I suggested to Jim to call real virFileExists() I forgot to
also suggest calling init_syms(). Without it, real_virFileExists
pointer might be left unset. And indeed, that's what we were
seeing on FreeBSD.
This effectively reverts commit 4b5cc57ed3
.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
parent
4b5cc57ed3
commit
01f2b614a2
@ -66,6 +66,7 @@ static int (*real_close)(int fd);
|
||||
static int (*real_setfilecon_raw)(const char *path, const char *context);
|
||||
static int (*real_getfilecon_raw)(const char *path, char **context);
|
||||
#endif
|
||||
static bool (*real_virFileExists)(const char *file);
|
||||
|
||||
|
||||
/* Global mutex to avoid races */
|
||||
@ -123,6 +124,7 @@ init_syms(void)
|
||||
VIR_MOCK_REAL_INIT(setfilecon_raw);
|
||||
VIR_MOCK_REAL_INIT(getfilecon_raw);
|
||||
#endif
|
||||
VIR_MOCK_REAL_INIT(virFileExists);
|
||||
|
||||
/* Intentionally not calling init_hash() here */
|
||||
}
|
||||
@ -386,8 +388,11 @@ bool virFileExists(const char *path)
|
||||
{
|
||||
VIR_LOCK_GUARD lock = virLockGuardLock(&m);
|
||||
|
||||
if (getenv(ENVVAR) == NULL)
|
||||
return access(path, F_OK) == 0;
|
||||
if (getenv(ENVVAR) == NULL) {
|
||||
init_syms();
|
||||
|
||||
return real_virFileExists(path);
|
||||
}
|
||||
|
||||
init_hash();
|
||||
if (virHashHasEntry(chown_paths, path))
|
||||
|
Loading…
Reference in New Issue
Block a user