netd: Wait when killing tethering services
Signed-off-by: San Mehat <san@google.com>
diff --git a/TetherController.cpp b/TetherController.cpp
index 7a352a1..3485a62 100644
--- a/TetherController.cpp
+++ b/TetherController.cpp
@@ -16,9 +16,13 @@
#include <stdlib.h>
#include <errno.h>
+#include <fcntl.h>
+
#include <sys/socket.h>
#include <sys/stat.h>
-#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -152,9 +156,11 @@
LOGD("Stopping tethering services");
kill(mDaemonPid, SIGTERM);
+ waitpid(mDaemonPid, NULL, 0);
mDaemonPid = 0;
close(mDaemonFd);
mDaemonFd = -1;
+ LOGD("Tethering services stopped");
return 0;
}