/***
This file is part of systemd.
- Copyright 2012 Kay Sievers <kay.sievers@vrfy.org>
+ Copyright 2012 Kay Sievers <kay@vrfy.org>
Copyright 2008 Alan Jenkins <alan.christopher.jenkins@googlemail.com>
systemd is free software; you can redistribute it and/or modify it
linebuf_rem_char(buf);
}
- if (node->values_count && fnmatch(linebuf_get(buf), search, 0) == 0)
- for (i = 0; i < node->values_count; i++) {
+ if (le64toh(node->values_count) && fnmatch(linebuf_get(buf), search, 0) == 0)
+ for (i = 0; i < le64toh(node->values_count); i++) {
err = hwdb_add_property(hwdb, trie_string(hwdb, trie_node_values(hwdb, node)[i].key_off),
trie_string(hwdb, trie_node_values(hwdb, node)[i].value_off));
if (err < 0)
if (search[i] == '\0') {
size_t n;
- for (n = 0; n < node->values_count; n++) {
+ for (n = 0; n < le64toh(node->values_count); n++) {
err = hwdb_add_property(hwdb, trie_string(hwdb, trie_node_values(hwdb, node)[n].key_off),
trie_string(hwdb, trie_node_values(hwdb, node)[n].value_off));
if (err < 0)
return false;
if (fstat(fileno(hwdb->f), &st) < 0)
return true;
- if (ts_usec(&hwdb->st.st_mtim) != ts_usec(&st.st_mtim))
+ if (timespec_load(&hwdb->st.st_mtim) != timespec_load(&st.st_mtim))
return true;
return false;
}
_public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev_hwdb *hwdb, const char *modalias, unsigned int flags) {
int err;
- if (!hwdb->f) {
+ if (!hwdb || !hwdb->f) {
errno = EINVAL;
return NULL;
}