Loading init/builtins.c +16 −28 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <sys/resource.h> #include <linux/loop.h> #include <cutils/partition_utils.h> #include <sys/system_properties.h> #include "init.h" #include "keywords.h" Loading Loading @@ -448,22 +449,15 @@ int do_setprop(int nargs, char **args) { const char *name = args[1]; const char *value = args[2]; char prop_val[PROP_VALUE_MAX]; int ret; if (value[0] == '$') { /* Use the value of a system property if value starts with '$' */ value++; if (value[0] != '$') { value = property_get(value); if (!value) { ERROR("property %s has no value for assigning to %s\n", value, name); ret = expand_props(prop_val, value, sizeof(prop_val)); if (ret) { ERROR("cannot expand '%s' while assigning to '%s'\n", value, name); return -EINVAL; } } /* else fall through to support double '$' prefix for setting properties * to string literals that start with '$' */ } property_set(name, value); property_set(name, prop_val); return 0; } Loading Loading @@ -547,21 +541,15 @@ int do_write(int nargs, char **args) { const char *path = args[1]; const char *value = args[2]; if (value[0] == '$') { /* Write the value of a system property if value starts with '$' */ value++; if (value[0] != '$') { value = property_get(value); if (!value) { ERROR("property %s has no value for writing to %s\n", value, path); char prop_val[PROP_VALUE_MAX]; int ret; ret = expand_props(prop_val, value, sizeof(prop_val)); if (ret) { ERROR("cannot expand '%s' while writing to '%s'\n", value, path); return -EINVAL; } } /* else fall through to support double '$' prefix for writing * string literals that start with '$' */ } return write_file(path, value); return write_file(path, prop_val); } int do_copy(int nargs, char **args) Loading init/init_parser.c +1 −1 Original line number Diff line number Diff line Loading @@ -176,7 +176,7 @@ static int push_chars(char **dst, int *len, const char *chars, int cnt) return 0; } static int expand_props(char *dst, const char *src, int dst_size) int expand_props(char *dst, const char *src, int dst_size) { int cnt = 0; char *dst_ptr = dst; Loading init/init_parser.h +1 −0 Original line number Diff line number Diff line Loading @@ -31,5 +31,6 @@ void queue_all_property_triggers(); void queue_builtin_action(int (*func)(int nargs, char **args), char *name); int init_parse_config_file(const char *fn); int expand_props(char *dst, const char *src, int len); #endif Loading
init/builtins.c +16 −28 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <sys/resource.h> #include <linux/loop.h> #include <cutils/partition_utils.h> #include <sys/system_properties.h> #include "init.h" #include "keywords.h" Loading Loading @@ -448,22 +449,15 @@ int do_setprop(int nargs, char **args) { const char *name = args[1]; const char *value = args[2]; char prop_val[PROP_VALUE_MAX]; int ret; if (value[0] == '$') { /* Use the value of a system property if value starts with '$' */ value++; if (value[0] != '$') { value = property_get(value); if (!value) { ERROR("property %s has no value for assigning to %s\n", value, name); ret = expand_props(prop_val, value, sizeof(prop_val)); if (ret) { ERROR("cannot expand '%s' while assigning to '%s'\n", value, name); return -EINVAL; } } /* else fall through to support double '$' prefix for setting properties * to string literals that start with '$' */ } property_set(name, value); property_set(name, prop_val); return 0; } Loading Loading @@ -547,21 +541,15 @@ int do_write(int nargs, char **args) { const char *path = args[1]; const char *value = args[2]; if (value[0] == '$') { /* Write the value of a system property if value starts with '$' */ value++; if (value[0] != '$') { value = property_get(value); if (!value) { ERROR("property %s has no value for writing to %s\n", value, path); char prop_val[PROP_VALUE_MAX]; int ret; ret = expand_props(prop_val, value, sizeof(prop_val)); if (ret) { ERROR("cannot expand '%s' while writing to '%s'\n", value, path); return -EINVAL; } } /* else fall through to support double '$' prefix for writing * string literals that start with '$' */ } return write_file(path, value); return write_file(path, prop_val); } int do_copy(int nargs, char **args) Loading
init/init_parser.c +1 −1 Original line number Diff line number Diff line Loading @@ -176,7 +176,7 @@ static int push_chars(char **dst, int *len, const char *chars, int cnt) return 0; } static int expand_props(char *dst, const char *src, int dst_size) int expand_props(char *dst, const char *src, int dst_size) { int cnt = 0; char *dst_ptr = dst; Loading
init/init_parser.h +1 −0 Original line number Diff line number Diff line Loading @@ -31,5 +31,6 @@ void queue_all_property_triggers(); void queue_builtin_action(int (*func)(int nargs, char **args), char *name); int init_parse_config_file(const char *fn); int expand_props(char *dst, const char *src, int len); #endif