summaryrefslogtreecommitdiffstats
path: root/src/logging.c
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-09-17 14:38:17 +0200
committerSylvain Munaut <tnt@246tNt.com>2010-09-17 14:38:17 +0200
commitaf5ee34c353ea2868a4b04b227bc1b511e1ac42b (patch)
treedd0cb703f458c39f6c8fe5d467f879ec2c42f34e /src/logging.c
parent77b6f6c53672f3d3c3335f17572bf4425122bd62 (diff)
Make sure we don't user std{err,in,out} if they don't exist.
This is required for target build in libosmocore Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/logging.c')
-rw-r--r--src/logging.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/logging.c b/src/logging.c
index 5be4e58e..b3b5cb69 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -294,14 +294,11 @@ void log_set_category_filter(struct log_target *target, int category,
target->categories[category].loglevel = level;
}
-/* since C89/C99 says stderr is a macro, we can safely do this! */
-#ifdef stderr
static void _file_output(struct log_target *target, const char *log)
{
fprintf(target->tgt_file.out, "%s", log);
fflush(target->tgt_file.out);
}
-#endif
struct log_target *log_target_create(void)
{
@@ -374,8 +371,12 @@ void log_target_destroy(struct log_target *target)
log_del_target(target);
if (target->output == &_file_output) {
+/* since C89/C99 says stderr is a macro, we can safely do this! */
+#ifdef stderr
/* don't close stderr */
- if (target->tgt_file.out != stderr) {
+ if (target->tgt_file.out != stderr)
+#endif
+ {
fclose(target->tgt_file.out);
target->tgt_file.out = NULL;
}