1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-10-29 22:24:51 +00:00

Merge pull request #306 from marcbonnici/revent_BC

Revent: Fixed backwards compatibility with v1
This commit is contained in:
setrofim
2016-12-02 17:02:06 +00:00
committed by GitHub
4 changed files with 10 additions and 2 deletions

View File

@@ -630,9 +630,12 @@ int read_legacy_replay_event(int fdin, replay_event_t* ev)
char padding[EVENT_PADDING_SIZE];
rb = read(fdin, &(ev->dev_idx), sizeof(int32_t));
if (rb < (int)sizeof(int32_t))
if (rb < (int)sizeof(int32_t)){
//Allow for abrupt ending of legacy recordings.
if (!errno)
return EOF;
return errno;
}
rb = read(fdin, &padding, EVENT_PADDING_SIZE);
if (rb < (int)sizeof(int32_t))
return errno;
@@ -997,6 +1000,10 @@ inline void read_revent_recording_or_die(const char *filepath, revent_recording_
fsize = get_file_size(filepath);
recording->events = malloc((size_t)fsize);
i = 0;
// Safely get file descriptor for fin, by flushing first.
fflush(fin);
while (1) {
ret = read_legacy_replay_event(fileno(fin), &recording->events[i]);
if (ret == EOF) {