summaryrefslogtreecommitdiffstats
path: root/init/property_service.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2017-09-26 16:30:03 -0700
committerTom Cherry <tomcherry@google.com>2017-09-26 16:30:03 -0700
commit4a679454d7055c09ea7c491e265b475bce582a65 (patch)
treef514470510111d1448131b539e9f4267011a3f45 /init/property_service.cpp
parentf5dba11085eec3a9f5c3d2f97c8d41e2708eca96 (diff)
downloadsystem_core-4a679454d7055c09ea7c491e265b475bce582a65.tar.gz
system_core-4a679454d7055c09ea7c491e265b475bce582a65.tar.bz2
system_core-4a679454d7055c09ea7c491e265b475bce582a65.zip
init: cleanup exit() uses
Primarily, this fixes a bug where a forked child of property service uses exit() instead of _exit, which has the unintended consequences of running the global destructors of init proper, which leads to unintended cleanup. Secondly, this replaces the remaining calls of exit() that really should be LOG(FATAL). Test: boot sailfish Change-Id: I779228e7d44a73186bc7685bb723c4b9278a0a2d
Diffstat (limited to 'init/property_service.cpp')
-rw-r--r--init/property_service.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/init/property_service.cpp b/init/property_service.cpp
index db2d47230..0df96bfff 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -73,8 +73,7 @@ static struct selabel_handle* sehandle_prop;
void property_init() {
if (__system_property_area_init()) {
- LOG(ERROR) << "Failed to initialize property area";
- exit(1);
+ LOG(FATAL) << "Failed to initialize property area";
}
}
@@ -216,7 +215,7 @@ static void PropertyChildLaunch() {
LOG(ERROR) << "property_set_async(\"" << info.name << "\", \"" << info.value
<< "\") failed";
}
- exit(0);
+ _exit(0);
}
}
@@ -712,8 +711,7 @@ void start_property_service() {
property_set_fd = CreateSocket(PROP_SERVICE_NAME, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
false, 0666, 0, 0, nullptr);
if (property_set_fd == -1) {
- PLOG(ERROR) << "start_property_service socket creation failed";
- exit(1);
+ PLOG(FATAL) << "start_property_service socket creation failed";
}
listen(property_set_fd, 8);