aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-09 14:34:28 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-04-09 14:34:28 +0200
commit125d0154e6c591addbaf1fae7c9ffdf5b7e7ed7b (patch)
treed447fcdf0cefef523bc26d1de800f3db7e00dad9
parente69ad87802139b7b62fc06ff5d5d09cc4245d5fc (diff)
downloadbusybox-w32-125d0154e6c591addbaf1fae7c9ffdf5b7e7ed7b.tar.gz
busybox-w32-125d0154e6c591addbaf1fae7c9ffdf5b7e7ed7b.tar.bz2
busybox-w32-125d0154e6c591addbaf1fae7c9ffdf5b7e7ed7b.zip
Exclude syslog code if FEATURE_SYSLOG is not set
syslog.h and syslog(...) may not exist in such configuration Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/info_msg.c12
-rw-r--r--libbb/verror_msg.c9
2 files changed, 16 insertions, 5 deletions
diff --git a/libbb/info_msg.c b/libbb/info_msg.c
index bc9d23b95..81164faa0 100644
--- a/libbb/info_msg.c
+++ b/libbb/info_msg.c
@@ -8,7 +8,9 @@
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
11#include <syslog.h> 11#if ENABLE_FEATURE_SYSLOG
12# include <syslog.h>
13#endif
12 14
13void FAST_FUNC bb_info_msg(const char *s, ...) 15void FAST_FUNC bb_info_msg(const char *s, ...)
14{ 16{
@@ -24,8 +26,10 @@ void FAST_FUNC bb_info_msg(const char *s, ...)
24 vprintf(s, p); 26 vprintf(s, p);
25 fputs(msg_eol, stdout); 27 fputs(msg_eol, stdout);
26 } 28 }
27 if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG)) 29# if ENABLE_FEATURE_SYSLOG
30 if (logmode & LOGMODE_SYSLOG)
28 vsyslog(LOG_INFO, s, p2); 31 vsyslog(LOG_INFO, s, p2);
32# endif
29 va_end(p2); 33 va_end(p2);
30 va_end(p); 34 va_end(p);
31#else 35#else
@@ -42,8 +46,10 @@ void FAST_FUNC bb_info_msg(const char *s, ...)
42 if (used < 0) 46 if (used < 0)
43 return; 47 return;
44 48
45 if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG)) 49# if ENABLE_FEATURE_SYSLOG
50 if (logmode & LOGMODE_SYSLOG)
46 syslog(LOG_INFO, "%s", msg); 51 syslog(LOG_INFO, "%s", msg);
52# endif
47 if (logmode & LOGMODE_STDIO) { 53 if (logmode & LOGMODE_STDIO) {
48 fflush_all(); 54 fflush_all();
49 /* used = strlen(msg); - must be true already */ 55 /* used = strlen(msg); - must be true already */
diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c
index 70f792f39..613432906 100644
--- a/libbb/verror_msg.c
+++ b/libbb/verror_msg.c
@@ -6,9 +6,10 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */ 8 */
9
10#include "libbb.h" 9#include "libbb.h"
11#include <syslog.h> 10#if ENABLE_FEATURE_SYSLOG
11# include <syslog.h>
12#endif
12 13
13smallint logmode = LOGMODE_STDIO; 14smallint logmode = LOGMODE_STDIO;
14const char *msg_eol = "\n"; 15const char *msg_eol = "\n";
@@ -67,9 +68,11 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p, const char* strerr)
67 fflush_all(); 68 fflush_all();
68 full_write(STDERR_FILENO, msg, used); 69 full_write(STDERR_FILENO, msg, used);
69 } 70 }
71#if ENABLE_FEATURE_SYSLOG
70 if (logmode & LOGMODE_SYSLOG) { 72 if (logmode & LOGMODE_SYSLOG) {
71 syslog(LOG_ERR, "%s", msg + applet_len); 73 syslog(LOG_ERR, "%s", msg + applet_len);
72 } 74 }
75#endif
73 free(msg); 76 free(msg);
74} 77}
75 78
@@ -128,9 +131,11 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p, const char* strerr)
128 fflush_all(); 131 fflush_all();
129 writev(STDERR_FILENO, iov, 3); 132 writev(STDERR_FILENO, iov, 3);
130 } 133 }
134# if ENABLE_FEATURE_SYSLOG
131 if (logmode & LOGMODE_SYSLOG) { 135 if (logmode & LOGMODE_SYSLOG) {
132 syslog(LOG_ERR, "%s", msgc); 136 syslog(LOG_ERR, "%s", msgc);
133 } 137 }
138# endif
134 free(msgc); 139 free(msgc);
135} 140}
136#endif 141#endif