Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 478846
Collapse All | Expand All

(-)a/libudev/libudev-hwdb.c (-5 / +5 lines)
Lines 275-304 Link Here
275
        hwdb->refcount = 1;
275
        hwdb->refcount = 1;
276
        udev_list_init(udev, &hwdb->properties_list, true);
276
        udev_list_init(udev, &hwdb->properties_list, true);
277
277
278
        hwdb->f = fopen("/etc/udev/hwdb.bin", "re");
278
        hwdb->f = fopen("/lib/syslocal/hwdb.bin", "re");
279
        if (!hwdb->f) {
279
        if (!hwdb->f) {
280
                log_debug("error reading /etc/udev/hwdb.bin: %m");
280
                log_debug("error reading /lib/syslocal/hwdb.bin: %m");
281
                udev_hwdb_unref(hwdb);
281
                udev_hwdb_unref(hwdb);
282
                return NULL;
282
                return NULL;
283
        }
283
        }
284
284
285
        if (fstat(fileno(hwdb->f), &hwdb->st) < 0 ||
285
        if (fstat(fileno(hwdb->f), &hwdb->st) < 0 ||
286
            (size_t)hwdb->st.st_size < offsetof(struct trie_header_f, strings_len) + 8) {
286
            (size_t)hwdb->st.st_size < offsetof(struct trie_header_f, strings_len) + 8) {
287
                log_debug("error reading /etc/udev/hwdb.bin: %m");
287
                log_debug("error reading /lib/syslocal/hwdb.bin: %m");
288
                udev_hwdb_unref(hwdb);
288
                udev_hwdb_unref(hwdb);
289
                return NULL;
289
                return NULL;
290
        }
290
        }
291
291
292
        hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0);
292
        hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0);
293
        if (hwdb->map == MAP_FAILED) {
293
        if (hwdb->map == MAP_FAILED) {
294
                log_debug("error mapping /etc/udev/hwdb.bin: %m");
294
                log_debug("error mapping /lib/syslocal/hwdb.bin: %m");
295
                udev_hwdb_unref(hwdb);
295
                udev_hwdb_unref(hwdb);
296
                return NULL;
296
                return NULL;
297
        }
297
        }
298
298
299
        if (memcmp(hwdb->map, sig, sizeof(hwdb->head->signature)) != 0 ||
299
        if (memcmp(hwdb->map, sig, sizeof(hwdb->head->signature)) != 0 ||
300
            (size_t)hwdb->st.st_size != le64toh(hwdb->head->file_size)) {
300
            (size_t)hwdb->st.st_size != le64toh(hwdb->head->file_size)) {
301
                log_debug("error recognizing the format of /etc/udev/hwdb.bin");
301
                log_debug("error recognizing the format of /lib/syslocal/hwdb.bin");
302
                udev_hwdb_unref(hwdb);
302
                udev_hwdb_unref(hwdb);
303
                return NULL;
303
                return NULL;
304
        }
304
        }
(-)a/udev/udevadm-hwdb.c (-1 / +1 lines)
Lines 628-634 Link Here
628
                log_debug("strings dedup'ed: %8zu bytes (%8zu)\n",
628
                log_debug("strings dedup'ed: %8zu bytes (%8zu)\n",
629
                          trie->strings->dedup_len, trie->strings->dedup_count);
629
                          trie->strings->dedup_len, trie->strings->dedup_count);
630
630
631
                if (asprintf(&hwdb_bin, "%s/etc/udev/hwdb.bin", root) < 0) {
631
                if (asprintf(&hwdb_bin, "%s/lib/syslocal/hwdb.bin", root) < 0) {
632
                        rc = EXIT_FAILURE;
632
                        rc = EXIT_FAILURE;
633
                        goto out;
633
                        goto out;
634
                }
634
                }

Return to bug 478846