diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-11-29 14:46:40 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-11-30 15:48:11 -0500 |
commit | 389be927b485ceb7351963986232fb6975860680 (patch) | |
tree | 3cf328ad168dce4c2b06be7ea2db0985b685ff4d /src | |
parent | 0f2e01a503d5763087da95d7a001cf84f190d19b (diff) |
hwdb: remove path comparison which broke overriding of properties
Partial fix for #4750.
We would compare strings like "/usr/lib/udev/hwdb.d/something.hwdb" and
"/etc/udev/hwdb.db/something.hwdb" and conclude that the first has higher
priority. Since we process files in order (higher priority later), no
comparison is necessary when loading.
This partially undoes 3a04b789c6f17dff2000a3cdbeaaf86baa604524
(not in spirit, but in the implementation).
Diffstat (limited to 'src')
-rw-r--r-- | src/hwdb/hwdb.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c index 1d16d9f8aa..af31578e11 100644 --- a/src/hwdb/hwdb.c +++ b/src/hwdb/hwdb.c @@ -163,7 +163,6 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, const char *filename, size_t line_number) { ssize_t k, v, fn; struct trie_value_entry *val; - int r; k = strbuf_add_string(trie->strings, key, strlen(key)); if (k < 0) @@ -183,17 +182,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp, trie); if (val) { - /* - * At this point we have 2 identical properties on the same match-string. We - * strictly order them by filename+line-number, since we know the dynamic - * runtime lookup does the same for multiple matching nodes. + /* At this point we have 2 identical properties on the same match-string. + * Since we process files in order, we just replace the previous value. */ - r = strcmp(filename, trie->strings->buf + val->filename_off); - if (r < 0 || - (r == 0 && line_number < val->line_number)) - return 0; - - /* replace existing earlier key with new value */ val->value_off = v; val->filename_off = fn; val->line_number = line_number; |