OSDN Git Service

Run dnsmasq with options --keep-in-foreground and --pid-file.
authorPeter Nilsson <peter6.nilsson@sonyericsson.com>
Thu, 8 Sep 2011 16:48:31 +0000 (09:48 -0700)
committerBjorn Andersson <bjorn.andersson@sonymobile.com>
Fri, 4 May 2012 01:15:39 +0000 (18:15 -0700)
Tell dnsmasq to run with option --keep-in-foreground instead
of --no-daemon, which is meant for debug purposes only. Also
use option --pid-file to tell dnsmasq not use a pid file.

Change-Id: I82858d911e94407b2511d8ce8388be553f2f09f6

TetherController.cpp

index 2059cce..4f54c4d 100644 (file)
@@ -134,15 +134,17 @@ int TetherController::startTethering(int num_addrs, struct in_addr* addrs) {
             close(pipefd[0]);
         }
 
-        int num_processed_args = 4 + (num_addrs/2) + 1; // 1 null for termination
+        int num_processed_args = 6 + (num_addrs/2) + 1; // 1 null for termination
         char **args = (char **)malloc(sizeof(char *) * num_processed_args);
         args[num_processed_args - 1] = NULL;
         args[0] = (char *)"/system/bin/dnsmasq";
-        args[1] = (char *)"--no-daemon";
+        args[1] = (char *)"--keep-in-foreground";
         args[2] = (char *)"--no-resolv";
         args[3] = (char *)"--no-poll";
+        args[4] = (char *)"--pid-file";
+        args[5] = (char *)"";
 
-        int nextArg = 4;
+        int nextArg = 6;
         for (int addrIndex=0; addrIndex < num_addrs;) {
             char *start = strdup(inet_ntoa(addrs[addrIndex++]));
             char *end = strdup(inet_ntoa(addrs[addrIndex++]));