OSDN Git Service

Merge "Revert "property_contexts: split into platform and non-platform components""
[android-x86/bionic.git] / libc / bionic / system_properties.cpp
index 0f68431..5aefbaf 100644 (file)
@@ -56,6 +56,7 @@
 #include "private/bionic_futex.h"
 #include "private/bionic_lock.h"
 #include "private/bionic_macros.h"
+#include "private/bionic_sdk_version.h"
 #include "private/libc_logging.h"
 
 static const char property_service_socket[] = "/dev/socket/" PROP_SERVICE_NAME;
@@ -1046,7 +1047,7 @@ int __system_property_set_filename(const char *filename)
 int __system_property_area_init()
 {
     free_and_unmap_contexts();
-    mkdir(property_filename, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+    mkdir(property_filename, S_IRWXU | S_IXGRP | S_IXOTH);
     if (!initialize_properties()) {
         return -1;
     }
@@ -1265,6 +1266,11 @@ unsigned int __system_property_wait_any(unsigned int serial)
 
 const prop_info *__system_property_find_nth(unsigned n)
 {
+    if (bionic_get_application_target_sdk_version() >= __ANDROID_API_O__) {
+      __libc_fatal("__system_property_find_nth is not supported since Android O,"
+                   " please use __system_property_foreach instead.");
+    }
+
     find_nth_cookie cookie(n);
 
     const int err = __system_property_foreach(find_nth_fn, &cookie);