• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

修訂b3779558dcfbe99f0b9c1ef796e3728edad25672 (tree)
時間2009-05-09 03:27:42
作者Mike Lockwood <lockwood@andr...>
CommiterMike Lockwood

Log Message

init: Fix some broken code that did not cause problems until switching to gcc 4.4

Signed-off-by: Mike Lockwood <lockwood@android.com>

Change Summary

差異

--- a/init/parser.c
+++ b/init/parser.c
@@ -536,7 +536,7 @@ void queue_all_property_triggers()
536536 const char* name = act->name + strlen("property:");
537537 const char* equals = strchr(name, '=');
538538 if (equals) {
539- char* prop_name[PROP_NAME_MAX + 1];
539+ char prop_name[PROP_NAME_MAX + 1];
540540 const char* value;
541541 int length = equals - name;
542542 if (length > PROP_NAME_MAX) {
@@ -546,7 +546,7 @@ void queue_all_property_triggers()
546546 prop_name[length] = 0;
547547
548548 /* does the property exist, and match the trigger value? */
549- value = property_get((const char *)&prop_name[0]);
549+ value = property_get(prop_name);
550550 if (value && !strcmp(equals + 1, value)) {
551551 action_add_queue_tail(act);
552552 }
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -296,7 +296,7 @@ int property_set(const char *name, const char *value)
296296 __futex_wake(&pa->serial, INT32_MAX);
297297 }
298298 /* 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) {
300300 if (strcmp("net.change", name) == 0) {
301301 return 0;
302302 }
@@ -307,7 +307,7 @@ int property_set(const char *name, const char *value)
307307 */
308308 property_set("net.change", name);
309309 } else if (persistent_properties_loaded &&
310- strncmp("persist.", name, sizeof("persist.") - 1) == 0) {
310+ strncmp("persist.", name, strlen("persist.")) == 0) {
311311 /*
312312 * Don't write properties to disk until after we have read all default properties
313313 * to prevent them from being overwritten by default values.
@@ -446,8 +446,7 @@ static void load_persistent_properties()
446446
447447 if (dir) {
448448 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.")))
451450 continue;
452451 #if HAVE_DIRENT_D_TYPE
453452 if (entry->d_type != DT_REG)