diff options
author | San Mehat <san@google.com> | 2010-01-20 10:54:48 -0800 |
---|---|---|
committer | San Mehat <san@google.com> | 2010-01-20 10:55:28 -0800 |
commit | 33b344454b95ed99bad7d3fe4d493870923deaf6 (patch) | |
tree | 44dc7f7854a014e1db6dfa22d7684bdb8703e771 /src/log.c | |
parent | 5658bcb797978c3472335d93554405aba8236f66 (diff) | |
download | android_external_dnsmasq-33b344454b95ed99bad7d3fe4d493870923deaf6.tar.gz android_external_dnsmasq-33b344454b95ed99bad7d3fe4d493870923deaf6.tar.bz2 android_external_dnsmasq-33b344454b95ed99bad7d3fe4d493870923deaf6.zip |
dnsmasq: Allow runtime changing of DNS servers via STDIN
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'src/log.c')
-rwxr-xr-x | src/log.c | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -16,6 +16,10 @@ #include "dnsmasq.h" +#ifdef __ANDROID__ +#include <android/log.h> +#endif + /* Implement logging to /dev/log asynchronously. If syslogd is making DNS lookups through dnsmasq, and dnsmasq blocks awaiting syslogd, then the two daemons can deadlock. We get around this @@ -261,6 +265,9 @@ void my_syslog(int priority, const char *format, ...) size_t len; pid_t pid = getpid(); char *func = ""; +#ifdef __ANDROID__ + int alog_lvl; +#endif if ((LOG_FACMASK & priority) == MS_TFTP) func = "-tftp"; @@ -278,6 +285,20 @@ void my_syslog(int priority, const char *format, ...) fputc('\n', stderr); } +#ifdef __ANDROID__ + if (priority <= LOG_ERR) + alog_lvl = ANDROID_LOG_ERROR; + else if (priority == LOG_WARNING) + alog_lvl = ANDROID_LOG_WARN; + else if (priority <= LOG_INFO) + alog_lvl = ANDROID_LOG_INFO; + else + alog_lvl = ANDROID_LOG_DEBUG; + va_start(ap, format); + __android_log_vprint(alog_lvl, "dnsmasq", format, ap); + va_end(ap); +#else + if (log_fd == -1) { /* fall-back to syslog if we die during startup or fail during running. */ @@ -369,7 +390,8 @@ void my_syslog(int priority, const char *format, ...) /* Have another go now */ log_write(); } - } + } +#endif } void set_log_writer(fd_set *set, int *maxfdp) |