syslog.h and syslog(...) may not exist in such configuration
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]>
---
libbb/info_msg.c | 10 ++++++++--
libbb/verror_msg.c | 6 ++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/libbb/info_msg.c b/libbb/info_msg.c
index bc9d23b..6fbcff5 100644
--- a/libbb/info_msg.c
+++ b/libbb/info_msg.c
@@ -8,7 +8,9 @@
*/
#include "libbb.h"
+#if ENABLE_FEATURE_SYSLOG
#include <syslog.h>
+#endif
void FAST_FUNC bb_info_msg(const char *s, ...)
{
@@ -24,8 +26,10 @@ void FAST_FUNC bb_info_msg(const char *s, ...)
vprintf(s, p);
fputs(msg_eol, stdout);
}
- if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG))
+#if ENABLE_FEATURE_SYSLOG
+ if (logmode & LOGMODE_SYSLOG)
vsyslog(LOG_INFO, s, p2);
+#endif
va_end(p2);
va_end(p);
#else
@@ -42,8 +46,10 @@ void FAST_FUNC bb_info_msg(const char *s, ...)
if (used < 0)
return;
- if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG))
+#if ENABLE_FEATURE_SYSLOG
+ if (logmode & LOGMODE_SYSLOG)
syslog(LOG_INFO, "%s", msg);
+#endif
if (logmode & LOGMODE_STDIO) {
fflush_all();
/* used = strlen(msg); - must be true already */
diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c
index 70f792f..b489f29 100644
--- a/libbb/verror_msg.c
+++ b/libbb/verror_msg.c
@@ -8,7 +8,9 @@
*/
#include "libbb.h"
+#if ENABLE_FEATURE_SYSLOG
#include <syslog.h>
+#endif
smallint logmode = LOGMODE_STDIO;
const char *msg_eol = "\n";
@@ -67,9 +69,11 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p, const
char* strerr)
fflush_all();
full_write(STDERR_FILENO, msg, used);
}
+#if ENABLE_FEATURE_SYSLOG
if (logmode & LOGMODE_SYSLOG) {
syslog(LOG_ERR, "%s", msg + applet_len);
}
+#endif
free(msg);
}
@@ -128,9 +132,11 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p,
const char* strerr)
fflush_all();
writev(STDERR_FILENO, iov, 3);
}
+#if ENABLE_FEATURE_SYSLOG
if (logmode & LOGMODE_SYSLOG) {
syslog(LOG_ERR, "%s", msgc);
}
+#endif
free(msgc);
}
#endif
--
1.7.0.rc1.541.g2da82.dirty
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox