chiark / gitweb /
udev: use usec_t and now()
[elogind.git] / src / libudev / libudev-hwdb.c
index 92c58b61a2594a9592620ca496e655e4fd6057a5..e72123a3af4ed2cea3ca458b4b036ef8bf07dc39 100644 (file)
@@ -35,7 +35,7 @@
  * SECTION:libudev-hwdb
  * @short_description: retrieve properties from the hardware database
  *
- * Libuded hardware database interface.
+ * Libudev hardware database interface.
  */
 
 /**
@@ -338,10 +338,10 @@ _public_ struct udev_hwdb *udev_hwdb_unref(struct udev_hwdb *hwdb) {
         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;
@@ -356,7 +356,7 @@ bool udev_hwdb_validate(struct udev_hwdb *hwdb) {
                 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;
 }
@@ -382,6 +382,7 @@ _public_ struct udev_list_entry *udev_hwdb_get_properties_list_entry(struct udev
                 return NULL;
         }
 
+        udev_list_cleanup(&hwdb->properties_list);
         err = trie_search_f(hwdb, modalias);
         if (err < 0) {
                 errno = -err;