diff options
author | David Zero <zero@cpp.edu> | 2016-12-02 04:37:23 -0800 |
---|---|---|
committer | David Zero <zero@cpp.edu> | 2017-01-04 13:44:39 -0800 |
commit | f3469070fe899e8e4fd88665386a55bad9f77cd8 (patch) | |
tree | c24743d266d3a8593792ef3e8661006cb283368a /other/bootstrap_daemon/src | |
parent | 535b8238fd191710e1e8864f302fba5a02f52b1d (diff) |
Portability fixes
- CFLAG gnu99 was changed to c99.
- CXXFLAG c++98 was changed to c++11.
- CFLAG -pedantic-errors was added so that non-ISO C now throws errors.
- _XOPEN_SOURCE feature test macro added and set to 600 to expose SUSv3
and c99 definitions in modules that required them.
- Fixed tests (and bootstrap daemon logging) that were failing due to
the altered build flags.
- Avoid string suffix misinterpretation; explicit narrowing conversion.
- Misc. additions to .gitignore to make sure build artifacts don't wind
up in version control.
Diffstat (limited to 'other/bootstrap_daemon/src')
-rw-r--r-- | other/bootstrap_daemon/src/log.c | 19 | ||||
-rw-r--r-- | other/bootstrap_daemon/src/tox-bootstrapd.c | 2 |
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 | ||
83 | static void log_syslog(LOG_LEVEL level, const char *format, va_list args) | 83 | static 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 | ||
88 | static FILE *level_stdout(LOG_LEVEL level) | 103 | static 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> |