mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
tests: Turn virFileWrapperAddPrefix to void
In theory, it's nice to have virFileWrapperAddPrefix() return a value that indicates if the function succeeded or not. But in practice, nobody checks for that and in fact blindly believes that the function succeeded. Therefore, make the function return nothing and just abort() if it would fail. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
8b71b0c727
commit
288e0ab106
@ -66,13 +66,15 @@ static void init_syms(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
virFileWrapperAddPrefix(const char *prefix,
|
virFileWrapperAddPrefix(const char *prefix,
|
||||||
const char *override)
|
const char *override)
|
||||||
{
|
{
|
||||||
/* Both parameters are mandatory */
|
/* Both parameters are mandatory */
|
||||||
if (!prefix || !override)
|
if (!prefix || !override) {
|
||||||
return -1;
|
fprintf(stderr, "Attempt to add invalid path override\n");
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
init_syms();
|
init_syms();
|
||||||
|
|
||||||
@ -80,10 +82,9 @@ virFileWrapperAddPrefix(const char *prefix,
|
|||||||
VIR_APPEND_ELEMENT_QUIET(overrides, noverrides, override) < 0) {
|
VIR_APPEND_ELEMENT_QUIET(overrides, noverrides, override) < 0) {
|
||||||
VIR_FREE(prefixes);
|
VIR_FREE(prefixes);
|
||||||
VIR_FREE(overrides);
|
VIR_FREE(overrides);
|
||||||
return -1;
|
fprintf(stderr, "Unable to add path override for '%s'\n", prefix);
|
||||||
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#ifndef LIBVIRT_VIRFILEWRAPPER_H
|
#ifndef LIBVIRT_VIRFILEWRAPPER_H
|
||||||
# define LIBVIRT_VIRFILEWRAPPER_H
|
# define LIBVIRT_VIRFILEWRAPPER_H
|
||||||
|
|
||||||
int
|
void
|
||||||
virFileWrapperAddPrefix(const char *prefix,
|
virFileWrapperAddPrefix(const char *prefix,
|
||||||
const char *override);
|
const char *override);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user