From: JP Abgrall Date: Mon, 6 Aug 2012 20:44:44 +0000 (-0700) Subject: TetherController: Use correct exit() after fork()+failed exec(). X-Git-Tag: android-x86-7.1-r1~410^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ce4f37979316dacf99d5bd3298e870bd35d14aac;p=android-x86%2Fsystem-netd.git TetherController: Use correct exit() after fork()+failed exec(). The bluetooth hack I98a1c8aedfa042b1824de7d8c69f2600c9bfcf29 uses the wrong exit() after the exec() fail. This will have undesirable effects like cpp destructors and atexit() funcs being invoked which could have undesirable effects for the parent. Also fixed other prior instance of fork()+exec()+"return" Change-Id: I8c09472a371640a710c55fc18e020b9c152bf9cc --- diff --git a/TetherController.cpp b/TetherController.cpp index 5f571a1..cb48dbc 100644 --- a/TetherController.cpp +++ b/TetherController.cpp @@ -158,8 +158,7 @@ int TetherController::startTethering(int num_addrs, struct in_addr* addrs) { ALOGE("execl failed (%s)", strerror(errno)); } ALOGE("Should never get here!"); - free(args); - return 0; + _exit(-1); } else { close(pipefd[0]); mDaemonPid = pid; @@ -233,7 +232,7 @@ int TetherController::startReverseTethering(const char* iface) { // TODO(BT) inform parent of the failure. // Parent process need wait for child to report error status // before it set mDhcpcdPid and return 0. - exit(-1); + _exit(-1); } else { mDhcpcdPid = pid; ALOGD("Reverse Tethering running, pid:%d", pid);