From fa35855bb68c81b87228bab6a636f2687325452c Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Thu, 27 Oct 2016 14:36:43 +0100 Subject: [PATCH] mraa.c: Use mraa_atoi instead of atoi in lockfile adding Signed-off-by: Brendan Le Foll --- src/mraa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mraa.c b/src/mraa.c index e8e3568..dd36c16 100644 --- a/src/mraa.c +++ b/src/mraa.c @@ -1144,7 +1144,9 @@ mraa_add_from_lockfile(const char* imraa_lock_file) struct json_object *ioobj = json_object_array_get_idx(ioarray, i); json_object_object_foreach(ioobj, key, val) { if (strcmp(key, "id") == 0) { - id = atoi(json_object_get_string(val)); + if (mraa_atoi(json_object_get_string(val), &id) != MRAA_SUCCESS) { + id = -1; + } } else if (strcmp(key, "uart") == 0) { uartdev = json_object_get_string(val); }