aboutsummaryrefslogtreecommitdiff
path: root/slirp/slirp.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-11-22 02:06:41 +0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-01-14 23:36:38 +0100
commit226ea7a96485f2b9db13b523551c536dc68a1689 (patch)
treec2e90a49e934d31ca6e22678888e63c07785f856 /slirp/slirp.c
parent2a2d3e4a258b9ed7ef5be7c6e421d58a365a0297 (diff)
downloadqemu-226ea7a96485f2b9db13b523551c536dc68a1689.zip
qemu-226ea7a96485f2b9db13b523551c536dc68a1689.tar.gz
qemu-226ea7a96485f2b9db13b523551c536dc68a1689.tar.bz2
slirp: call into g_debug() for DEBUG macros
Make slirp use GLib logging, instead of fprintf(), so that applications can filter log, process it etc. With recent versions of glib, G_MESSAGES_DEBUG must be set to "all" or "Slirp" to see slirp debug messages. Reformat DEBUG_MISC & DEBUG_ERROR calls to not need \n ending. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/slirp.c')
-rw-r--r--slirp/slirp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 535c8ad..a9674ab 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -166,7 +166,7 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr,
if (!f)
return -1;
- DEBUG_MISC("IP address of your DNS(s): ");
+ DEBUG_MISC("IP address of your DNS(s):");
while (fgets(buff, 512, f) != NULL) {
if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) {
char *c = strchr(buff2, '%');
@@ -188,20 +188,18 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr,
*scope_id = if_index;
}
*cached_time = curtime;
- } else {
- DEBUG_MISC(", ");
}
if (++found > 3) {
- DEBUG_MISC("(more)");
+ DEBUG_MISC(" (more)");
break;
} else if (slirp_debug & DBG_MISC) {
char s[INET6_ADDRSTRLEN];
const char *res = inet_ntop(af, tmp_addr, s, sizeof(s));
if (!res) {
- res = "(string conversion error)";
+ res = " (string conversion error)";
}
- DEBUG_MISC("%s", res);
+ DEBUG_MISC(" %s", res);
}
}
}