[PATCH evemu 5/7] tools: handle sscanf return value
Peter Hutterer
peter.hutterer at who-t.net
Tue Aug 18 18:03:28 PDT 2015
Coverity complains. There isn't really a case where this should go wrong, so
we can silently ignore the error case.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
tools/find_event_devices.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/find_event_devices.c b/tools/find_event_devices.c
index 1f7539a..36aa3ac 100644
--- a/tools/find_event_devices.c
+++ b/tools/find_event_devices.c
@@ -47,6 +47,7 @@ char* find_event_devices(void)
int i, ndev, devnum;
char *filename;
int max_device = 0;
+ int rc;
ndev = scandir(DEV_INPUT_EVENT, &namelist, is_event_device, versionsort);
if (ndev <= 0)
@@ -70,8 +71,8 @@ char* find_event_devices(void)
fprintf(stderr, "%s: %s\n", fname, name);
close(fd);
- sscanf(namelist[i]->d_name, "event%d", &devnum);
- if (devnum > max_device)
+ rc = sscanf(namelist[i]->d_name, "event%d", &devnum);
+ if (rc == 1 && devnum > max_device)
max_device = devnum;
free(namelist[i]);
--
2.4.3
More information about the Input-tools
mailing list