chiark / gitweb /
udev: kmod, hwdb - do not fail if databases are not available
authorKay Sievers <kay@vrfy.org>
Thu, 25 Oct 2012 20:58:02 +0000 (22:58 +0200)
committerKay Sievers <kay@vrfy.org>
Thu, 25 Oct 2012 20:58:02 +0000 (22:58 +0200)
src/udev/udev-builtin-hwdb.c
src/udev/udev-builtin-kmod.c

index 1458795e993bb151d69b0164421aafc725f71081..c1a6f5c791b52d3e8096cb13daacb995c42b2e87 100644 (file)
@@ -307,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;
@@ -361,7 +364,7 @@ static bool builtin_hwdb_validate(struct udev *udev)
         struct stat st;
 
         if (!trie.f)
-                return true;
+                return false;
         if (fstat(fileno(trie.f), &st) < 0)
                 return true;
         if (trie.file_time_usec != ts_usec(&st.st_mtim))
index 9d3605bc6ba92d2cabd436ad3d8e6eb57d5a655c..1df055bea570bc06a72aa7343f4eb7d8735094b7 100644 (file)
@@ -39,8 +39,6 @@ static int load_module(struct udev *udev, const char *alias)
         struct kmod_list *l;
         int err;
 
-        assert(ctx);
-
         err = kmod_module_new_from_lookup(ctx, alias, &list);
         if (err < 0)
                 return err;
@@ -77,6 +75,9 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te
         struct udev *udev = udev_device_get_udev(dev);
         int i;
 
+        if (ctx)
+                return 0;
+
         if (argc < 3 || strcmp(argv[1], "load")) {
                 log_error("expect: %s load <module>\n", argv[0]);
                 return EXIT_FAILURE;