probe-app: bail out if opening file fails

Do not blindly call fwrite without checking whether file open
succeeded or not.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit is contained in:
Kai Vehmanen 2022-08-11 16:24:48 +03:00 committed by Liam Girdwood
parent 89039c6bff
commit e2a5d925ba
1 changed files with 7 additions and 0 deletions

View File

@ -297,6 +297,13 @@ void parse_data(char *file_in)
packet->buffer_id, packet->buffer_id,
packet->format); packet->format);
if (file < 0) {
fprintf(stderr,
"unable to open file for %u\n",
packet->buffer_id);
goto err;
}
fwrite(packet->data, fwrite(packet->data,
sizeof(uint32_t), sizeof(uint32_t),
packet->data_size_bytes / packet->data_size_bytes /