[PATCH 2/4] Handle asprintf return value.
Martin Minarik
minarik11 at student.fiit.stuba.sk
Fri Aug 23 10:31:48 PDT 2013
Fix compiler warning. In case it returns -1, halt the lookup
and return NULL.
---
test/test-common-uinput.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/test-common-uinput.c b/test/test-common-uinput.c
index b99bfa8..9f0198b 100644
--- a/test/test-common-uinput.c
+++ b/test/test-common-uinput.c
@@ -154,7 +154,8 @@ wait_for_inotify(int fd)
while (bufidx > sizeof(*e) && bufidx >= sizeof(*e) + e->len) {
if (strncmp(e->name, "event", 5) == 0) {
- asprintf(&devnode, "%s%s", DEV_INPUT_DIR, e->name);
+ if (-1 == asprintf(&devnode, "%s%s", DEV_INPUT_DIR, e->name))
+ return NULL;
found = 1;
break;
}
--
1.7.10.4
More information about the Input-tools
mailing list