Commit 9207c880 authored by nextime's avatar nextime

Fix pint_debug string formatting

parent 2877c458
pinthread (0.3) unstable; urgency=medium
* fix pint_debug string formatting
-- Franco (nextime) Lanza <nextime@nexlab.it> Mon, 13 Jul 2015 01:04:09 +0200
pinthread (0.2) unstable; urgency=medium
* Add debug env option
......
......@@ -49,6 +49,7 @@
#include <libgen.h>
#include <stdbool.h>
#include <string.h>
#include <stdarg.h>
static char *procname;
static bool pinthread_override = false;
......@@ -77,8 +78,20 @@ static int (*real_sched_setaffinity)(pid_t pid, size_t cpusetsize,
static void pint_debug(const char *msg, ...)
{
va_list args;
char *str;
int len;
va_start(args, msg);
len = vsnprintf(NULL, 0, msg, args);
if ((str = malloc(len+1)) == NULL)
return;
vsnprintf(str, len+1, msg, args);
va_end(args);
if(pinthread_debug)
fprintf(stderr, "D:PINTHREAD %s\n", msg);
fprintf(stderr, "D:PINTHREAD: %s\n", str);
}
static void main_pinthread(int argc, char* argv[], char* envp[])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment