Skip to content

Commit e2a5d92

Browse files
kv2019ilgirdwood
authored andcommitted
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>
1 parent 89039c6 commit e2a5d92

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tools/probes/probes_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,13 @@ void parse_data(char *file_in)
297297
packet->buffer_id,
298298
packet->format);
299299

300+
if (file < 0) {
301+
fprintf(stderr,
302+
"unable to open file for %u\n",
303+
packet->buffer_id);
304+
goto err;
305+
}
306+
300307
fwrite(packet->data,
301308
sizeof(uint32_t),
302309
packet->data_size_bytes /

0 commit comments

Comments
 (0)