diff options
author | Mike Lockwood <lockwood@android.com> | 2009-05-08 14:27:42 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2009-05-08 14:27:42 -0400 |
commit | b3779558dcfbe99f0b9c1ef796e3728edad25672 (patch) | |
tree | a9b56e1a49c55040bdfcc986dcadf47330327b5b | |
parent | 3d40729054803fae1c4d4bb5ac7554665a132b26 (diff) | |
download | system_core-b3779558dcfbe99f0b9c1ef796e3728edad25672.zip system_core-b3779558dcfbe99f0b9c1ef796e3728edad25672.tar.gz system_core-b3779558dcfbe99f0b9c1ef796e3728edad25672.tar.bz2 |
init: Fix some broken code that did not cause problems until switching to gcc 4.4
Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r-- | init/parser.c | 4 | ||||
-rw-r--r-- | init/property_service.c | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/init/parser.c b/init/parser.c index 6a22d24..30fa3de 100644 --- a/init/parser.c +++ b/init/parser.c @@ -536,7 +536,7 @@ void queue_all_property_triggers() const char* name = act->name + strlen("property:"); const char* equals = strchr(name, '='); if (equals) { - char* prop_name[PROP_NAME_MAX + 1]; + char prop_name[PROP_NAME_MAX + 1]; const char* value; int length = equals - name; if (length > PROP_NAME_MAX) { @@ -546,7 +546,7 @@ void queue_all_property_triggers() prop_name[length] = 0; /* does the property exist, and match the trigger value? */ - value = property_get((const char *)&prop_name[0]); + value = property_get(prop_name); if (value && !strcmp(equals + 1, value)) { action_add_queue_tail(act); } diff --git a/init/property_service.c b/init/property_service.c index 0bc6239..48ca3ea 100644 --- a/init/property_service.c +++ b/init/property_service.c @@ -296,7 +296,7 @@ int property_set(const char *name, const char *value) __futex_wake(&pa->serial, INT32_MAX); } /* If name starts with "net." treat as a DNS property. */ - if (strncmp("net.", name, sizeof("net.") - 1) == 0) { + if (strncmp("net.", name, strlen("net.")) == 0) { if (strcmp("net.change", name) == 0) { return 0; } @@ -307,7 +307,7 @@ int property_set(const char *name, const char *value) */ property_set("net.change", name); } else if (persistent_properties_loaded && - strncmp("persist.", name, sizeof("persist.") - 1) == 0) { + strncmp("persist.", name, strlen("persist.")) == 0) { /* * Don't write properties to disk until after we have read all default properties * to prevent them from being overwritten by default values. @@ -446,8 +446,7 @@ static void load_persistent_properties() if (dir) { while ((entry = readdir(dir)) != NULL) { - if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") || - strncmp("persist.", entry->d_name, sizeof("persist.") - 1)) + if (strncmp("persist.", entry->d_name, strlen("persist."))) continue; #if HAVE_DIRENT_D_TYPE if (entry->d_type != DT_REG) |