system/corennnnn
Revision | b3779558dcfbe99f0b9c1ef796e3728edad25672 (tree) |
---|---|
Zeit | 2009-05-09 03:27:42 |
Autor | Mike Lockwood <lockwood@andr...> |
Commiter | Mike Lockwood |
init: Fix some broken code that did not cause problems until switching to gcc 4.4
Signed-off-by: Mike Lockwood <lockwood@android.com>
@@ -536,7 +536,7 @@ void queue_all_property_triggers() | ||
536 | 536 | const char* name = act->name + strlen("property:"); |
537 | 537 | const char* equals = strchr(name, '='); |
538 | 538 | if (equals) { |
539 | - char* prop_name[PROP_NAME_MAX + 1]; | |
539 | + char prop_name[PROP_NAME_MAX + 1]; | |
540 | 540 | const char* value; |
541 | 541 | int length = equals - name; |
542 | 542 | if (length > PROP_NAME_MAX) { |
@@ -546,7 +546,7 @@ void queue_all_property_triggers() | ||
546 | 546 | prop_name[length] = 0; |
547 | 547 | |
548 | 548 | /* does the property exist, and match the trigger value? */ |
549 | - value = property_get((const char *)&prop_name[0]); | |
549 | + value = property_get(prop_name); | |
550 | 550 | if (value && !strcmp(equals + 1, value)) { |
551 | 551 | action_add_queue_tail(act); |
552 | 552 | } |
@@ -296,7 +296,7 @@ int property_set(const char *name, const char *value) | ||
296 | 296 | __futex_wake(&pa->serial, INT32_MAX); |
297 | 297 | } |
298 | 298 | /* If name starts with "net." treat as a DNS property. */ |
299 | - if (strncmp("net.", name, sizeof("net.") - 1) == 0) { | |
299 | + if (strncmp("net.", name, strlen("net.")) == 0) { | |
300 | 300 | if (strcmp("net.change", name) == 0) { |
301 | 301 | return 0; |
302 | 302 | } |
@@ -307,7 +307,7 @@ int property_set(const char *name, const char *value) | ||
307 | 307 | */ |
308 | 308 | property_set("net.change", name); |
309 | 309 | } else if (persistent_properties_loaded && |
310 | - strncmp("persist.", name, sizeof("persist.") - 1) == 0) { | |
310 | + strncmp("persist.", name, strlen("persist.")) == 0) { | |
311 | 311 | /* |
312 | 312 | * Don't write properties to disk until after we have read all default properties |
313 | 313 | * to prevent them from being overwritten by default values. |
@@ -446,8 +446,7 @@ static void load_persistent_properties() | ||
446 | 446 | |
447 | 447 | if (dir) { |
448 | 448 | while ((entry = readdir(dir)) != NULL) { |
449 | - if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") || | |
450 | - strncmp("persist.", entry->d_name, sizeof("persist.") - 1)) | |
449 | + if (strncmp("persist.", entry->d_name, strlen("persist."))) | |
451 | 450 | continue; |
452 | 451 | #if HAVE_DIRENT_D_TYPE |
453 | 452 | if (entry->d_type != DT_REG) |