summaryrefslogtreecommitdiffstats
path: root/worker/debug.c
blob: 7253f4142d2380e5f60e905b3f2431fcf029d769 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* taken from Stephen's sssd tree */
#define _GNU_SOURCE
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>

int debug_level = 5;

void debug_fn(const char *format, ...)
{
    va_list ap;
    char *s = NULL;
    int ret;

    va_start(ap, format);
    ret=vasprintf(&s, format, ap);
    va_end(ap);
    if (ret==-1) {
        fprintf(stderr, "DEBUG_FN: vasprintf failed!!!\n");
        return;
    }

    /*write(state.fd, s, strlen(s)); */
    fprintf(stderr, s);
    free(s);
}