Merge "libcutils: fs_config: target_out_path assumed /system breaking partitions"
diff --git a/include/system b/include/system
new file mode 120000
index 0000000..91d45be
--- /dev/null
+++ b/include/system
@@ -0,0 +1 @@
+../libsystem/include/system/
\ No newline at end of file
diff --git a/liblog/properties.c b/liblog/properties.c
index 0b0ef52..adf1900 100644
--- a/liblog/properties.c
+++ b/liblog/properties.c
@@ -95,7 +95,7 @@
/* calculate the size of our key temporary buffer */
const size_t taglen = tag ? len : 0;
/* sizeof(log_namespace) = strlen(log_namespace) + 1 */
- char key[sizeof(log_namespace) + taglen]; /* may be > PROP_NAME_MAX */
+ char key[sizeof(log_namespace) + taglen];
char* kp;
size_t i;
char c = 0;
@@ -108,7 +108,8 @@
* Where the missing tag matches all tags and becomes the
* system global default. We do not support ro.log.tag* .
*/
- static char last_tag[PROP_NAME_MAX];
+ static char* last_tag;
+ static size_t last_tag_len;
static uint32_t global_serial;
/* some compilers erroneously see uninitialized use. !not_locked */
uint32_t current_global_serial = 0;
@@ -147,25 +148,29 @@
if (taglen) {
int local_change_detected = change_detected;
if (!not_locked) {
- if (!last_tag[0] || (last_tag[0] != tag[0]) ||
- strncmp(
- last_tag + 1, tag + 1,
- (len < sizeof(last_tag)) ? (len - 1) : (sizeof(last_tag) - 1)) ||
- ((len < sizeof(last_tag)) && last_tag[len])) {
+ if (!last_tag || !last_tag[0] || (last_tag[0] != tag[0]) ||
+ strncmp(last_tag + 1, tag + 1, last_tag_len - 1)) {
/* invalidate log.tag.<tag> cache */
for (i = 0; i < (sizeof(tag_cache) / sizeof(tag_cache[0])); ++i) {
tag_cache[i].cache.pinfo = NULL;
tag_cache[i].c = '\0';
}
- last_tag[0] = '\0';
+ if (last_tag) last_tag[0] = '\0';
local_change_detected = 1;
}
- if (!last_tag[0]) {
- if (len < sizeof(last_tag)) {
+ if (!last_tag || !last_tag[0]) {
+ if (!last_tag) {
+ last_tag = calloc(1, len + 1);
+ last_tag_len = 0;
+ if (last_tag) last_tag_len = len + 1;
+ } else if (len >= last_tag_len) {
+ last_tag = realloc(last_tag, len + 1);
+ last_tag_len = 0;
+ if (last_tag) last_tag_len = len + 1;
+ }
+ if (last_tag) {
strncpy(last_tag, tag, len);
last_tag[len] = '\0';
- } else {
- strncpy(last_tag, tag, sizeof(last_tag));
}
}
}
@@ -435,7 +440,7 @@
int flag) {
struct cache_property property = { { NULL, -1 }, { 0 } };
if (flag & BOOL_DEFAULT_FLAG_PERSIST) {
- char newkey[PROP_NAME_MAX];
+ char newkey[strlen("persist.") + strlen(key) + 1];
snprintf(newkey, sizeof(newkey), "ro.%s", key);
refresh_cache_property(&property, newkey);
property.cache.pinfo = NULL;
@@ -600,8 +605,8 @@
evaluate_property_get_size
/* clang-format on */
};
- char key_persist[PROP_NAME_MAX];
- char key_ro[PROP_NAME_MAX];
+ char key_persist[strlen(global_tunable) + strlen(".security") + 1];
+ char key_ro[strlen(global_default) + strlen(".security") + 1];
struct cache2_property_size local = {
/* clang-format off */
PTHREAD_MUTEX_INITIALIZER, 0,
diff --git a/libsystem/Android.bp b/libsystem/Android.bp
new file mode 100644
index 0000000..4d076d5
--- /dev/null
+++ b/libsystem/Android.bp
@@ -0,0 +1,4 @@
+cc_library_headers {
+ name: "libsystem_headers",
+ export_include_dirs: ["include"],
+}
diff --git a/include/system/camera.h b/libsystem/include/system/camera.h
similarity index 100%
rename from include/system/camera.h
rename to libsystem/include/system/camera.h
diff --git a/include/system/graphics.h b/libsystem/include/system/graphics.h
similarity index 100%
rename from include/system/graphics.h
rename to libsystem/include/system/graphics.h
diff --git a/include/system/qemu_pipe.h b/libsystem/include/system/qemu_pipe.h
similarity index 100%
rename from include/system/qemu_pipe.h
rename to libsystem/include/system/qemu_pipe.h
diff --git a/include/system/radio.h b/libsystem/include/system/radio.h
similarity index 100%
rename from include/system/radio.h
rename to libsystem/include/system/radio.h
diff --git a/include/system/thread_defs.h b/libsystem/include/system/thread_defs.h
similarity index 100%
rename from include/system/thread_defs.h
rename to libsystem/include/system/thread_defs.h
diff --git a/include/system/window.h b/libsystem/include/system/window.h
similarity index 100%
rename from include/system/window.h
rename to libsystem/include/system/window.h