[systemd-commits] src/udev

Kay Sievers kay at kemper.freedesktop.org
Thu Oct 25 13:58:49 PDT 2012


 src/udev/udev-builtin-hwdb.c |    5 ++++-
 src/udev/udev-builtin-kmod.c |    5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 5b4d50efe83851fe84837db795e14b1d64be530b
Author: Kay Sievers <kay at vrfy.org>
Date:   Thu Oct 25 22:58:02 2012 +0200

    udev: kmod, hwdb - do not fail if databases are not available

diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
index 1458795..c1a6f5c 100644
--- a/src/udev/udev-builtin-hwdb.c
+++ b/src/udev/udev-builtin-hwdb.c
@@ -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))
diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c
index 9d3605b..1df055b 100644
--- a/src/udev/udev-builtin-kmod.c
+++ b/src/udev/udev-builtin-kmod.c
@@ -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;



More information about the systemd-commits mailing list