lib/debug Use vdprintf rather than manually allocate
authorAndrew Bartlett <abartlet@samba.org>
Fri, 29 Oct 2010 04:56:29 +0000 (15:56 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 2 Nov 2010 00:18:43 +0000 (00:18 +0000)
This allows the system to use whatever buffers it wants for the string
rather than assuming we need to malloc() it.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Nov  2 00:18:43 UTC 2010 on sn-devel-104

lib/util/debug.c

index 055dfbb12e1a846551df7cd1c524b7f03fdd06c6..5760a709ef5772f7cdf4d460a44007bdce3e440e 100644 (file)
@@ -118,16 +118,12 @@ _PUBLIC_ void dbghdrclass(int level, int dclass, const char *location, const cha
 _PUBLIC_ void dbgtext(const char *format, ...)
 {
        va_list ap;
-       char *s = NULL;
 
        if (!check_reopen_logs()) return;
 
        va_start(ap, format);
-       vasprintf(&s, format, ap);
+       vdprintf(state.fd, format, ap);
        va_end(ap);
-
-       write(state.fd, s, strlen(s));
-       free(s);
 }
 
 _PUBLIC_ const char *logfile = NULL;