From b26c5a4d7d4b2fd19160a1ff20cece13b2c18b13 Mon Sep 17 00:00:00 2001 From: wb2osz Date: Sat, 28 Sep 2024 01:58:16 +0100 Subject: [PATCH] Improve error message. --- src/deviceid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/deviceid.c b/src/deviceid.c index de910e5..d57a6f2 100644 --- a/src/deviceid.c +++ b/src/deviceid.c @@ -528,7 +528,7 @@ static int mice_cmp (const void *px, const void *py) void deviceid_decode_dest (char *dest, char *device, size_t device_size) { - *device = '\0'; + strlcpy (device, "UNKNOWN vendor/model", device_size); if (ptocalls == NULL) { text_color_set(DW_COLOR_ERROR); @@ -554,6 +554,7 @@ void deviceid_decode_dest (char *dest, char *device, size_t device_size) } } +// Not found in table. strlcpy (device, "UNKNOWN vendor/model", device_size); } // end deviceid_decode_dest @@ -610,7 +611,7 @@ static inline int strncmp_z (char *a, char *b, size_t len) void deviceid_decode_mice (char *comment, char *trimmed, size_t trimmed_size, char *device, size_t device_size) { - *device = '\0'; + strlcpy (device, "UNKNOWN vendor/model", device_size); if (ptocalls == NULL) { text_color_set(DW_COLOR_ERROR);