git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add-domain: Suppress libvirt errors on stderr.
[libguestfs.git]
/
src
/
virt.c
diff --git
a/src/virt.c
b/src/virt.c
index
a23ac0a
..
cd48888
100644
(file)
--- a/
src/virt.c
+++ b/
src/virt.c
@@
-53,6
+53,12
@@
init_libxml2 (void)
LIBXML_TEST_VERSION;
}
LIBXML_TEST_VERSION;
}
+static void
+ignore_errors (void *ignore, virErrorPtr ignore2)
+{
+ /* empty */
+}
+
struct guestfs___add_libvirt_dom_argv {
uint64_t bitmask;
#define GUESTFS___ADD_LIBVIRT_DOM_READONLY_BITMASK (UINT64_C(1)<<0)
struct guestfs___add_libvirt_dom_argv {
uint64_t bitmask;
#define GUESTFS___ADD_LIBVIRT_DOM_READONLY_BITMASK (UINT64_C(1)<<0)
@@
-102,6
+108,12
@@
guestfs__add_domain (guestfs_h *g, const char *domain_name,
goto cleanup;
}
goto cleanup;
}
+ /* Suppress default behaviour of printing errors to stderr. Note
+ * you can't set this to NULL to ignore errors; setting it to NULL
+ * restores the default error handler ...
+ */
+ virConnSetErrorFunc (conn, NULL, ignore_errors);
+
dom = virDomainLookupByName (conn, domain_name);
if (!dom) {
err = virGetLastError ();
dom = virDomainLookupByName (conn, domain_name);
if (!dom) {
err = virGetLastError ();
@@
-305,7
+317,7
@@
static int
guestfs___add_libvirt_dom (guestfs_h *g, virDomainPtr dom,
const struct guestfs___add_libvirt_dom_argv *optargs)
{
guestfs___add_libvirt_dom (guestfs_h *g, virDomainPtr dom,
const struct guestfs___add_libvirt_dom_argv *optargs)
{
-
in
t cmdline_pos;
+
size_
t cmdline_pos;
int r;
int readonly;
const char *iface;
int r;
int readonly;
const char *iface;