Use posix_spawn instead of vfork
Also correct usage of posix_spawn
Bug: 126128460
Test: built, flashed, booted
system/netd/tests/runtests.sh pass
manual test with remove dnsmasq, netd works fine
Change-Id: Id48c7bf9c02ea27d3a4602efa3913785c0d5c87f
diff --git a/server/ClatdController.cpp b/server/ClatdController.cpp
index 99c82b8..0290303 100644
--- a/server/ClatdController.cpp
+++ b/server/ClatdController.cpp
@@ -98,9 +98,9 @@
nullptr};
// Specify no flags and no actions, posix_spawn will use vfork and is
// guaranteed to return only once exec has been called.
- if (posix_spawn(&pid, kClatdPath, nullptr, nullptr, args, nullptr)) {
- int res = errno;
- ALOGE("posix_spawn failed (%s)", strerror(errno));
+ int res = posix_spawn(&pid, kClatdPath, nullptr, nullptr, args, nullptr);
+ if (res) {
+ ALOGE("posix_spawn failed (%s)", strerror(res));
return -res;
}