summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-11-04 14:00:03 -0500
committerStephen Gallagher <sgallagh@redhat.com>2009-11-04 18:32:48 -0500
commita98abccf998144ff81e429cdb16af5b93fe7973b (patch)
tree296c0df3adecf27769272f3249bcbfc89d18b8cb /server
parent6a8d1e90de09daa7dcbdcc548913946666f35ab1 (diff)
downloadsssd-a98abccf998144ff81e429cdb16af5b93fe7973b.tar.gz
sssd-a98abccf998144ff81e429cdb16af5b93fe7973b.tar.bz2
sssd-a98abccf998144ff81e429cdb16af5b93fe7973b.zip
Simplify debug_fn()
We don't need to be allocating an output string here. This was also causing a runtime bug when the output string contained characters that would be interpreted by fprintf as specifiers.
Diffstat (limited to 'server')
-rw-r--r--server/util/debug.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/server/util/debug.c b/server/util/debug.c
index 862367ce..df2ba693 100644
--- a/server/util/debug.c
+++ b/server/util/debug.c
@@ -56,23 +56,13 @@ errno_t set_debug_file_from_fd(const int fd)
void debug_fn(const char *format, ...)
{
va_list ap;
- char *s = NULL;
- int ret;
va_start(ap, format);
- ret = vasprintf(&s, format, ap);
- if (ret < 0) {
- /* ENOMEM */
- return;
- }
+ vfprintf(debug_file ? debug_file : stderr, format, ap);
+ fflush(debug_file ? debug_file : stderr);
va_end(ap);
-
- /*write(state.fd, s, strlen(s));*/
- fprintf(debug_file ? debug_file : stderr, s);
- fflush(debug_file ? debug_file : stderr);
- free(s);
}
void ldb_debug_messages(void *context, enum ldb_debug_level level,