fileio: fileio_size() can now fail

Part of making the fileio API more robust.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
This commit is contained in:
Øyvind Harboe
2010-09-29 09:11:01 +02:00
parent 3a693ef526
commit 3931b99d14
9 changed files with 92 additions and 20 deletions

View File

@@ -1897,7 +1897,15 @@ COMMAND_HANDLER(handle_etm_load_command)
return ERROR_FAIL;
}
if (fileio_size(&file) % 4)
int filesize;
int retval = fileio_size(&file, &filesize);
if (retval != ERROR_OK)
{
fileio_close(&file);
return retval;
}
if (filesize % 4)
{
command_print(CMD_CTX, "size isn't a multiple of 4, no valid trace data");
fileio_close(&file);