/***
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
* SECTION:libudev-hwdb
* @short_description: retrieve properties from the hardware database
*
- * Libuded hardware database interface.
+ * Libudev hardware database interface.
*/
/**
hwdb->refcount--;
if (hwdb->refcount > 0)
return hwdb;
- if (hwdb->f)
- fclose(hwdb->f);
if (hwdb->map)
munmap((void *)hwdb->map, hwdb->st.st_size);
+ if (hwdb->f)
+ fclose(hwdb->f);
udev_list_cleanup(&hwdb->properties_list);
free(hwdb);
return NULL;
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;
}
+ udev_list_cleanup(&hwdb->properties_list);
err = trie_search_f(hwdb, modalias);
if (err < 0) {
errno = -err;