mirror of
https://github.com/sheumann/hush.git
synced 2024-10-12 17:23:55 +00:00
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>
This commit is contained in:
parent
e69ad87802
commit
125d0154e6
@ -8,7 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
#if ENABLE_FEATURE_SYSLOG
|
||||||
# include <syslog.h>
|
# include <syslog.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void FAST_FUNC bb_info_msg(const char *s, ...)
|
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);
|
vprintf(s, p);
|
||||||
fputs(msg_eol, stdout);
|
fputs(msg_eol, stdout);
|
||||||
}
|
}
|
||||||
if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG))
|
# if ENABLE_FEATURE_SYSLOG
|
||||||
|
if (logmode & LOGMODE_SYSLOG)
|
||||||
vsyslog(LOG_INFO, s, p2);
|
vsyslog(LOG_INFO, s, p2);
|
||||||
|
# endif
|
||||||
va_end(p2);
|
va_end(p2);
|
||||||
va_end(p);
|
va_end(p);
|
||||||
#else
|
#else
|
||||||
@ -42,8 +46,10 @@ void FAST_FUNC bb_info_msg(const char *s, ...)
|
|||||||
if (used < 0)
|
if (used < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ENABLE_FEATURE_SYSLOG && (logmode & LOGMODE_SYSLOG))
|
# if ENABLE_FEATURE_SYSLOG
|
||||||
|
if (logmode & LOGMODE_SYSLOG)
|
||||||
syslog(LOG_INFO, "%s", msg);
|
syslog(LOG_INFO, "%s", msg);
|
||||||
|
# endif
|
||||||
if (logmode & LOGMODE_STDIO) {
|
if (logmode & LOGMODE_STDIO) {
|
||||||
fflush_all();
|
fflush_all();
|
||||||
/* used = strlen(msg); - must be true already */
|
/* used = strlen(msg); - must be true already */
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
*
|
*
|
||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
#if ENABLE_FEATURE_SYSLOG
|
||||||
# include <syslog.h>
|
# include <syslog.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
smallint logmode = LOGMODE_STDIO;
|
smallint logmode = LOGMODE_STDIO;
|
||||||
const char *msg_eol = "\n";
|
const char *msg_eol = "\n";
|
||||||
@ -67,9 +68,11 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p, const char* strerr)
|
|||||||
fflush_all();
|
fflush_all();
|
||||||
full_write(STDERR_FILENO, msg, used);
|
full_write(STDERR_FILENO, msg, used);
|
||||||
}
|
}
|
||||||
|
#if ENABLE_FEATURE_SYSLOG
|
||||||
if (logmode & LOGMODE_SYSLOG) {
|
if (logmode & LOGMODE_SYSLOG) {
|
||||||
syslog(LOG_ERR, "%s", msg + applet_len);
|
syslog(LOG_ERR, "%s", msg + applet_len);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
free(msg);
|
free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,9 +131,11 @@ void FAST_FUNC bb_verror_msg(const char *s, va_list p, const char* strerr)
|
|||||||
fflush_all();
|
fflush_all();
|
||||||
writev(STDERR_FILENO, iov, 3);
|
writev(STDERR_FILENO, iov, 3);
|
||||||
}
|
}
|
||||||
|
# if ENABLE_FEATURE_SYSLOG
|
||||||
if (logmode & LOGMODE_SYSLOG) {
|
if (logmode & LOGMODE_SYSLOG) {
|
||||||
syslog(LOG_ERR, "%s", msgc);
|
syslog(LOG_ERR, "%s", msgc);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
free(msgc);
|
free(msgc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user