chiark / gitweb /
udev: kmod, hwdb - do not fail if databases are not available
[elogind.git] / src / udev / udev-builtin-hwdb.c
index 4c3d5aea62d481b2424cc67573f8409f6dca034e..c1a6f5c791b52d3e8096cb13daacb995c42b2e87 100644 (file)
@@ -277,6 +277,9 @@ static int builtin_hwdb(struct udev_device *dev, int argc, char *argv[], bool te
         };
         const char *subsys = NULL;
 
+        if (!trie.f)
+                return EXIT_SUCCESS;
+
         for (;;) {
                 int option;
 
@@ -304,6 +307,9 @@ static int builtin_hwdb_init(struct udev *udev)
         struct stat st;
         const char sig[] = HWDB_SIG;
 
+        if (trie.f)
+                return 0;
+
         trie.f = fopen(SYSCONFDIR "/udev/hwdb.bin", "re");
         if (!trie.f)
                 return -errno;
@@ -357,6 +363,8 @@ static bool builtin_hwdb_validate(struct udev *udev)
 {
         struct stat st;
 
+        if (!trie.f)
+                return false;
         if (fstat(fileno(trie.f), &st) < 0)
                 return true;
         if (trie.file_time_usec != ts_usec(&st.st_mtim))