dnsmasq: Allow runtime changing of DNS servers via STDIN
Signed-off-by: San Mehat <san@google.com>
diff --git a/src/log.c b/src/log.c
index 7ec491d..2fc0c6e 100755
--- a/src/log.c
+++ b/src/log.c
@@ -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 @@
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 @@
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 @@
/* Have another go now */
log_write();
}
- }
+ }
+#endif
}
void set_log_writer(fd_set *set, int *maxfdp)