summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon
diff options
context:
space:
mode:
Diffstat (limited to 'other/bootstrap_daemon')
-rw-r--r--other/bootstrap_daemon/src/log.c19
-rw-r--r--other/bootstrap_daemon/src/tox-bootstrapd.c2
2 files changed, 19 insertions, 2 deletions
diff --git a/other/bootstrap_daemon/src/log.c b/other/bootstrap_daemon/src/log.c
index 7632d739..ae418f93 100644
--- a/other/bootstrap_daemon/src/log.c
+++ b/other/bootstrap_daemon/src/log.c
@@ -26,8 +26,8 @@
26 26
27#include "global.h" 27#include "global.h"
28 28
29#include <assert.h>
29#include <syslog.h> 30#include <syslog.h>
30
31#include <stdarg.h> 31#include <stdarg.h>
32#include <stdio.h> 32#include <stdio.h>
33 33
@@ -82,7 +82,22 @@ static int level_syslog(LOG_LEVEL level)
82 82
83static void log_syslog(LOG_LEVEL level, const char *format, va_list args) 83static void log_syslog(LOG_LEVEL level, const char *format, va_list args)
84{ 84{
85 vsyslog(level_syslog(level), format, args); 85 va_list args2;
86
87 va_copy(args2, args);
88 int size = vsnprintf(NULL, 0, format, args2);
89 va_end(args2);
90
91 assert(size >= 0);
92
93 if (size < 0) {
94 return;
95 }
96
97 char buf[size + 1];
98 vsnprintf(buf, size + 1, format, args);
99
100 syslog(level_syslog(level), "%s", buf);
86} 101}
87 102
88static FILE *level_stdout(LOG_LEVEL level) 103static FILE *level_stdout(LOG_LEVEL level)
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c
index 4495f88e..a0504eee 100644
--- a/other/bootstrap_daemon/src/tox-bootstrapd.c
+++ b/other/bootstrap_daemon/src/tox-bootstrapd.c
@@ -22,6 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#define _XOPEN_SOURCE 600
26
25// system provided 27// system provided
26#include <sys/stat.h> 28#include <sys/stat.h>
27#include <unistd.h> 29#include <unistd.h>