summaryrefslogtreecommitdiff
path: root/user/libwacom/fix-database.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/libwacom/fix-database.patch')
-rw-r--r--user/libwacom/fix-database.patch34
1 files changed, 22 insertions, 12 deletions
diff --git a/user/libwacom/fix-database.patch b/user/libwacom/fix-database.patch
index d367ca997..3c43b5bbf 100644
--- a/user/libwacom/fix-database.patch
+++ b/user/libwacom/fix-database.patch
@@ -1,15 +1,25 @@
-https://github.com/linuxwacom/libwacom/issues/85
-
-Awful, cheesy hack.
-
---- libwacom-0.33/libwacom/libwacom-database.c.old 2019-04-12 03:10:21.000000000 +0000
-+++ libwacom-0.33/libwacom/libwacom-database.c 2019-06-01 06:24:56.290159726 +0000
-@@ -152,7 +152,7 @@
-
- memset(namestr, 0, sizeof(namestr));
+diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
+index afb89a2..28388f5 100644
+--- a/libwacom/libwacom-database.c
++++ b/libwacom/libwacom-database.c
+@@ -147,14 +147,13 @@ make_match_string (const char *name, WacomBusType bus, int vendor_id, int produc
+ static gboolean
+ match_from_string(const char *str, WacomBusType *bus, int *vendor_id, int *product_id, char **name)
+ {
+- int rc = 1;
+- char busstr[64], namestr[64];
++ int rc = 1, len = 0;
++ char busstr[64];
+- memset(namestr, 0, sizeof(namestr));
+-
- rc = sscanf(str, "%63[^:]:%x:%x:%63c", busstr, vendor_id, product_id, namestr);
-+ rc = sscanf(str, "%63[^:]:%x:%x:%63[^\b]", busstr, vendor_id, product_id, namestr);
- if (rc == 4) {
- *name = g_strdup(namestr);
+- if (rc == 4) {
+- *name = g_strdup(namestr);
++ rc = sscanf(str, "%63[^:]:%x:%x:%n", busstr, vendor_id, product_id, &len);
++ if (len > 0) {
++ /* Grumble grumble scanf handling of %n */
++ *name = g_strdup(str+len);
} else if (rc == 3) {
+ *name = NULL;
+ } else {