* [PATCH] hwdb: Fall back to other known paths for hwdb.bin
@ 2016-08-01 19:11 Mat Martineau
2016-08-01 19:24 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Mat Martineau @ 2016-08-01 19:11 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 838 bytes --]
l_hwdb_new_default() assumed one standard path for hwdb.bin, but it can
vary depending on distro and whether the database is immutable or
regenerated by the system.
---
ell/hwdb.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/ell/hwdb.c b/ell/hwdb.c
index 0a26299..caa8eb3 100644
--- a/ell/hwdb.c
+++ b/ell/hwdb.c
@@ -161,7 +161,16 @@ failed:
LIB_EXPORT struct l_hwdb *l_hwdb_new_default(void)
{
- return l_hwdb_new("/etc/udev/hwdb.bin");
+ struct l_hwdb *db = NULL;
+ size_t i;
+ const char * const paths[] = {"/etc/udev/hwdb.bin",
+ "/usr/lib/udev/hwdb.bin",
+ "/lib/udev/hwdb.bin"};
+
+ for (i = 0; !db && i < L_ARRAY_SIZE(paths); i++)
+ db = l_hwdb_new(paths[i]);
+
+ return db;
}
LIB_EXPORT struct l_hwdb *l_hwdb_ref(struct l_hwdb *hwdb)
--
2.9.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwdb: Fall back to other known paths for hwdb.bin
2016-08-01 19:11 [PATCH] hwdb: Fall back to other known paths for hwdb.bin Mat Martineau
@ 2016-08-01 19:24 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2016-08-01 19:24 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 369 bytes --]
Hi Mat,
On 08/01/2016 02:11 PM, Mat Martineau wrote:
> l_hwdb_new_default() assumed one standard path for hwdb.bin, but it can
> vary depending on distro and whether the database is immutable or
> regenerated by the system.
> ---
> ell/hwdb.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
Applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-01 19:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-01 19:11 [PATCH] hwdb: Fall back to other known paths for hwdb.bin Mat Martineau
2016-08-01 19:24 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.