aboutsummaryrefslogtreecommitdiff
path: root/libbb/verror_msg.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/verror_msg.c')
-rw-r--r--libbb/verror_msg.c9
1 files changed, 7 insertions, 2 deletions
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