diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-02-13 02:42:50 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-02-13 02:44:36 -0500 |
commit | 9ee455572d97fd8ce458a6df523c447e85dc3edf (patch) | |
tree | 256d765aa56acb6484abfa0cc00c2554a304a71a /sim/rx/trace.c | |
parent | 136da8cd9c32379b6f4b504e62a9d1bebb36587f (diff) | |
download | gdb-9ee455572d97fd8ce458a6df523c447e85dc3edf.zip gdb-9ee455572d97fd8ce458a6df523c447e85dc3edf.tar.gz gdb-9ee455572d97fd8ce458a6df523c447e85dc3edf.tar.bz2 |
sim: rx: mitigate fread warning
Current toolchains warn about unused result from fread, so mitigate
the edge case if fread returns short data. It's not great, but it
gets things building again.
Diffstat (limited to 'sim/rx/trace.c')
-rw-r--r-- | sim/rx/trace.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sim/rx/trace.c b/sim/rx/trace.c index e5db49b..caa51b7 100644 --- a/sim/rx/trace.c +++ b/sim/rx/trace.c @@ -143,6 +143,7 @@ load_file_and_line (const char *filename, int lineno) FILE *file; int i; struct stat s; + size_t ret; const char *found_filename, *slash; found_filename = filename; @@ -162,8 +163,8 @@ load_file_and_line (const char *filename, int lineno) f->filename = strdup (filename); f->data = (char *) malloc (s.st_size + 2); file = fopen (found_filename, "rb"); - fread (f->data, 1, s.st_size, file); - f->data[s.st_size] = 0; + ret = fread (f->data, 1, s.st_size, file); + f->data[ret] = 0; fclose (file); f->nlines = 1; |