From: Antonio Ospite Date: Tue, 5 Jan 2016 22:01:07 +0000 (+0100) Subject: kinect_upload_fw: check the return value of get_first_reply() and get_reply() X-Git-Tag: v0.4~9 X-Git-Url: https://git.ao2.it/kinect-audio-setup.git/commitdiff_plain/e3a5c912deb8d75dd93a6ba54a63ae21d3e15137 kinect_upload_fw: check the return value of get_first_reply() and get_reply() --- diff --git a/kinect_upload_fw/kinect_upload_fw.c b/kinect_upload_fw/kinect_upload_fw.c index 5faf8e1..a88d3aa 100644 --- a/kinect_upload_fw/kinect_upload_fw.c +++ b/kinect_upload_fw/kinect_upload_fw.c @@ -197,7 +197,16 @@ int main(int argc, char** argv) { goto cleanup; } res = get_first_reply(); // This first one doesn't have the usual magic bytes at the beginning, and is 96 bytes long - much longer than the usual 12-byte replies. + if (res < 0) { + LOG("get_first_reply() failed"); + goto cleanup; + } + res = get_reply(); // I'm not sure why we do this twice here, but maybe it'll make sense later. + if (res < 0) { + LOG("First get_reply() failed"); + goto cleanup; + } seq++; // Split addr declaration and assignment in order to compile as C++, @@ -238,6 +247,10 @@ int main(int argc, char** argv) { bytes_sent += to_send; } res = get_reply(); + if (res < 0) { + LOG("get_reply failed"); + goto cleanup; + } addr += (uint32_t)read; seq++;