From: Volker Lendecke Date: Mon, 17 Jun 2024 12:42:30 +0000 (+0200) Subject: librpc: Make NDR_PRINT_DEBUG call just one DEBUG X-Git-Tag: tdb-1.4.11~251 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=a32f52e573561900cbed097c453b5240df3b0ae5;p=thirdparty%2Fsamba.git librpc: Make NDR_PRINT_DEBUG call just one DEBUG Give debug.c the chance to use just one write call (right now it doesn't yet) Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index 1478faa466f..1eaa278d820 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -439,12 +439,15 @@ _PUBLIC_ bool ndr_print_debug(int level, const char *function) { struct ndr_print *ndr; - - DEBUGLF(level, (" "), location, function); + bool ret = false; ndr = talloc_zero(NULL, struct ndr_print); if (!ndr) return false; - ndr->print = ndr_print_debug_helper; + ndr->private_data = talloc_strdup(ndr, ""); + if (ndr->private_data == NULL) { + goto fail; + } + ndr->print = ndr_print_string_helper; ndr->depth = 1; ndr->flags = 0; #ifdef DEBUG_PASSWORD @@ -454,8 +457,12 @@ _PUBLIC_ bool ndr_print_debug(int level, #endif fn(ndr, name, ptr); + DEBUGLF(level, (" %s", (char *)ndr->private_data), location, function); + + ret = true; +fail: talloc_free(ndr); - return true; + return ret; } /*