mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-01-22 05:32:42 +07:00
udev: kmod, hwdb - do not fail if databases are not available
This commit is contained in:
parent
3b0a5f2023
commit
5b4d50efe8
@ -307,6 +307,9 @@ static int builtin_hwdb_init(struct udev *udev)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
const char sig[] = HWDB_SIG;
|
const char sig[] = HWDB_SIG;
|
||||||
|
|
||||||
|
if (trie.f)
|
||||||
|
return 0;
|
||||||
|
|
||||||
trie.f = fopen(SYSCONFDIR "/udev/hwdb.bin", "re");
|
trie.f = fopen(SYSCONFDIR "/udev/hwdb.bin", "re");
|
||||||
if (!trie.f)
|
if (!trie.f)
|
||||||
return -errno;
|
return -errno;
|
||||||
@ -361,7 +364,7 @@ static bool builtin_hwdb_validate(struct udev *udev)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (!trie.f)
|
if (!trie.f)
|
||||||
return true;
|
return false;
|
||||||
if (fstat(fileno(trie.f), &st) < 0)
|
if (fstat(fileno(trie.f), &st) < 0)
|
||||||
return true;
|
return true;
|
||||||
if (trie.file_time_usec != ts_usec(&st.st_mtim))
|
if (trie.file_time_usec != ts_usec(&st.st_mtim))
|
||||||
|
@ -39,8 +39,6 @@ static int load_module(struct udev *udev, const char *alias)
|
|||||||
struct kmod_list *l;
|
struct kmod_list *l;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
assert(ctx);
|
|
||||||
|
|
||||||
err = kmod_module_new_from_lookup(ctx, alias, &list);
|
err = kmod_module_new_from_lookup(ctx, alias, &list);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
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);
|
struct udev *udev = udev_device_get_udev(dev);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (ctx)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (argc < 3 || strcmp(argv[1], "load")) {
|
if (argc < 3 || strcmp(argv[1], "load")) {
|
||||||
log_error("expect: %s load <module>\n", argv[0]);
|
log_error("expect: %s load <module>\n", argv[0]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user