summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/util/tevent_debug.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/util/tevent_debug.c b/lib/util/tevent_debug.c
index 3a5a3132f9..6df58aeaf0 100644
--- a/lib/util/tevent_debug.c
+++ b/lib/util/tevent_debug.c
@@ -30,7 +30,7 @@ static void samba_tevent_debug(void *context,
va_list ap)
{
int samba_level = -1;
- char *s = NULL;
+
switch (level) {
case TEVENT_DEBUG_FATAL:
samba_level = 0;
@@ -47,10 +47,21 @@ static void samba_tevent_debug(void *context,
};
if (CHECK_DEBUGLVL(samba_level)) {
- vasprintf(&s, fmt, ap);
- if (!s) return;
- DEBUG(samba_level, ("samba_tevent: %s", s));
- free(s);
+ const char *name = (const char *)context;
+ char *message = NULL;
+ int ret;
+
+ ret = vasprintf(&message, fmt, ap);
+ if (ret == -1) {
+ return;
+ }
+
+ if (name == NULL) {
+ name = "samba_tevent";
+ }
+
+ DEBUG(samba_level, ("%s: %s", name, message));
+ free(message);
}
}