aboutsummaryrefslogtreecommitdiff
path: root/toys/android/getprop.c
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2017-01-25 13:27:03 -0800
committerRob Landley <rob@landley.net>2017-01-25 17:36:06 -0600
commit102841199bee9cc76f3fff4335d6dbdd3c0cc8ab (patch)
tree52ff367e7e5f100ac930e257e352bcc0b7d8d410 /toys/android/getprop.c
parent4d8ffe62d06b1f7472e3dc0c63344311af5d68d0 (diff)
downloadtoybox-102841199bee9cc76f3fff4335d6dbdd3c0cc8ab.tar.gz
Remove name length limit for system properties
Android O removes name length limit for system properties. Use __system_property_read_callback instead of deprecated __system_property_read in getprop and remove check for property name length in setprop. Test: adb shell setprop debug.test.very.very.long.property.name valueforpropertywithlongname Test: adb shell getprop | grep debug.test.very.very.long.property.name Bug: http://b/33926793 Change-Id: I57ca99ea33283d069cd1b7b9f110ec9fb27f3d19
Diffstat (limited to 'toys/android/getprop.c')
-rw-r--r--toys/android/getprop.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/toys/android/getprop.c b/toys/android/getprop.c
index 390cb985..51e73444 100644
--- a/toys/android/getprop.c
+++ b/toys/android/getprop.c
@@ -39,13 +39,8 @@ static char *get_property_context(char *property)
return context;
}
-static void add_property(const prop_info *pi, void *unused)
+static void read_callback(void *unused, const char *name, const char *value)
{
- char name[PROP_NAME_MAX];
- char value[PROP_VALUE_MAX];
-
- __system_property_read(pi, name, value);
-
if (!(TT.size&31)) TT.nv = xrealloc(TT.nv, (TT.size+32)*2*sizeof(char *));
TT.nv[2*TT.size] = xstrdup(name);
@@ -56,6 +51,11 @@ static void add_property(const prop_info *pi, void *unused)
}
}
+static void add_property(const prop_info *pi, void *unused)
+{
+ __system_property_read_callback(pi, read_callback, NULL);
+}
+
// Needed to supress extraneous "Loaded property_contexts from" message
static int selinux_log_callback_local(int type, const char *fmt, ...)
{