diff options
Diffstat (limited to 'init/property_service.cpp')
-rw-r--r-- | init/property_service.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/init/property_service.cpp b/init/property_service.cpp index bbe353f4d..18e47e3df 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp | |||
@@ -14,47 +14,46 @@ | |||
14 | * limitations under the License. | 14 | * limitations under the License. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "property_service.h" | ||
18 | |||
19 | #include <ctype.h> | ||
20 | #include <dirent.h> | ||
21 | #include <errno.h> | ||
22 | #include <fcntl.h> | ||
17 | #include <inttypes.h> | 23 | #include <inttypes.h> |
24 | #include <limits.h> | ||
25 | #include <netinet/in.h> | ||
26 | #include <stdarg.h> | ||
27 | #include <stddef.h> | ||
18 | #include <stdio.h> | 28 | #include <stdio.h> |
19 | #include <stdlib.h> | 29 | #include <stdlib.h> |
20 | #include <unistd.h> | ||
21 | #include <string.h> | 30 | #include <string.h> |
22 | #include <ctype.h> | 31 | #include <sys/mman.h> |
23 | #include <fcntl.h> | ||
24 | #include <stdarg.h> | ||
25 | #include <dirent.h> | ||
26 | #include <limits.h> | ||
27 | #include <errno.h> | ||
28 | #include <sys/poll.h> | 32 | #include <sys/poll.h> |
29 | 33 | #include <sys/select.h> | |
30 | #include <memory> | 34 | #include <sys/types.h> |
31 | #include <vector> | 35 | #include <sys/un.h> |
36 | #include <unistd.h> | ||
32 | 37 | ||
33 | #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ | 38 | #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ |
34 | #include <sys/_system_properties.h> | 39 | #include <sys/_system_properties.h> |
35 | 40 | ||
36 | #include <sys/socket.h> | 41 | #include <memory> |
37 | #include <sys/un.h> | 42 | #include <vector> |
38 | #include <sys/select.h> | ||
39 | #include <sys/types.h> | ||
40 | #include <netinet/in.h> | ||
41 | #include <sys/mman.h> | ||
42 | |||
43 | #include <selinux/android.h> | ||
44 | #include <selinux/selinux.h> | ||
45 | #include <selinux/label.h> | ||
46 | 43 | ||
47 | #include <android-base/file.h> | 44 | #include <android-base/file.h> |
45 | #include <android-base/logging.h> | ||
48 | #include <android-base/properties.h> | 46 | #include <android-base/properties.h> |
49 | #include <android-base/stringprintf.h> | 47 | #include <android-base/stringprintf.h> |
50 | #include <android-base/strings.h> | 48 | #include <android-base/strings.h> |
49 | #include <bootimg.h> | ||
51 | #include <fs_mgr.h> | 50 | #include <fs_mgr.h> |
52 | #include "bootimg.h" | 51 | #include <selinux/android.h> |
52 | #include <selinux/label.h> | ||
53 | #include <selinux/selinux.h> | ||
53 | 54 | ||
54 | #include "property_service.h" | ||
55 | #include "init.h" | 55 | #include "init.h" |
56 | #include "util.h" | 56 | #include "util.h" |
57 | #include "log.h" | ||
58 | 57 | ||
59 | using android::base::StringPrintf; | 58 | using android::base::StringPrintf; |
60 | 59 | ||
@@ -178,7 +177,7 @@ uint32_t property_set(const std::string& name, const std::string& value) { | |||
178 | } | 177 | } |
179 | 178 | ||
180 | if (name == "selinux.restorecon_recursive" && valuelen > 0) { | 179 | if (name == "selinux.restorecon_recursive" && valuelen > 0) { |
181 | if (restorecon(value.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE) != 0) { | 180 | if (selinux_android_restorecon(value.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE) != 0) { |
182 | LOG(ERROR) << "Failed to restorecon_recursive " << value; | 181 | LOG(ERROR) << "Failed to restorecon_recursive " << value; |
183 | } | 182 | } |
184 | } | 183 | } |
@@ -511,8 +510,9 @@ static void load_properties(char *data, const char *filter) | |||
511 | static void load_properties_from_file(const char* filename, const char* filter) { | 510 | static void load_properties_from_file(const char* filename, const char* filter) { |
512 | Timer t; | 511 | Timer t; |
513 | std::string data; | 512 | std::string data; |
514 | if (!read_file(filename, &data)) { | 513 | std::string err; |
515 | PLOG(WARNING) << "Couldn't load properties from " << filename; | 514 | if (!ReadFile(filename, &data, &err)) { |
515 | PLOG(WARNING) << "Couldn't load property file: " << err; | ||
516 | return; | 516 | return; |
517 | } | 517 | } |
518 | data.push_back('\n'); | 518 | data.push_back('\n'); |
@@ -659,8 +659,8 @@ void load_system_props() { | |||
659 | void start_property_service() { | 659 | void start_property_service() { |
660 | property_set("ro.property_service.version", "2"); | 660 | property_set("ro.property_service.version", "2"); |
661 | 661 | ||
662 | property_set_fd = create_socket(PROP_SERVICE_NAME, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, | 662 | property_set_fd = CreateSocket(PROP_SERVICE_NAME, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, |
663 | 0666, 0, 0, NULL); | 663 | false, 0666, 0, 0, nullptr, sehandle); |
664 | if (property_set_fd == -1) { | 664 | if (property_set_fd == -1) { |
665 | PLOG(ERROR) << "start_property_service socket creation failed"; | 665 | PLOG(ERROR) << "start_property_service socket creation failed"; |
666 | exit(1); | 666 | exit(1); |