diff options
author | Kay Sievers <kay@vrfy.org> | 2012-10-26 03:43:56 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-10-26 03:45:25 +0200 |
commit | 4af113f9971217991cce51b45f15bdce22ee45e2 (patch) | |
tree | 1c19ee53d43cc9a33f1865e3ad900962c81848e1 /src/udev/udev-builtin-hwdb.c | |
parent | a4bcff5ba36115495994e9f9ba66074471de76ab (diff) |
udev: builtin - do not fail builtin initialization if one of them returns an error
Diffstat (limited to 'src/udev/udev-builtin-hwdb.c')
-rw-r--r-- | src/udev/udev-builtin-hwdb.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c index c1a6f5c791..14e9edab82 100644 --- a/src/udev/udev-builtin-hwdb.c +++ b/src/udev/udev-builtin-hwdb.c @@ -311,11 +311,14 @@ static int builtin_hwdb_init(struct udev *udev) return 0; trie.f = fopen(SYSCONFDIR "/udev/hwdb.bin", "re"); - if (!trie.f) + if (!trie.f) { + if (errno != EEXIST) + log_error("Error reading " SYSCONFDIR "/udev/hwdb.bin: %m"); return -errno; + } if (fstat(fileno(trie.f), &st) < 0 || (size_t)st.st_size < offsetof(struct trie_header_f, strings_len) + 8) { - log_error("Error reading '%s'.", SYSCONFDIR "/udev/hwdb.bin: %m"); + log_error("Error reading " SYSCONFDIR "/udev/hwdb.bin: %m"); fclose(trie.f); zero(trie); return -EINVAL; @@ -323,7 +326,7 @@ static int builtin_hwdb_init(struct udev *udev) trie.map = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fileno(trie.f), 0); if (trie.map == MAP_FAILED) { - log_error("Error mapping '%s'.", SYSCONFDIR "/udev/hwdb.bin: %m"); + log_error("Error mapping " SYSCONFDIR "/udev/hwdb.bin: %m"); fclose(trie.f); return -EINVAL; } @@ -331,7 +334,7 @@ static int builtin_hwdb_init(struct udev *udev) trie.map_size = st.st_size; if (memcmp(trie.map, sig, sizeof(trie.head->signature)) != 0 || (size_t)st.st_size != le64toh(trie.head->file_size)) { - log_error("Unable to recognize the format of '%s'.", SYSCONFDIR "/udev/hwdb.bin"); + log_error("Unable to recognize the format of " SYSCONFDIR "/udev/hwdb.bin."); log_error("Please try 'udevadm hwdb --update' to re-create it."); munmap((void *)trie.map, st.st_size); fclose(trie.f); |