aboutsummaryrefslogtreecommitdiff
path: root/gdb/tracepoint.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2010-04-13 03:53:50 +0000
committerStan Shebs <shebs@codesourcery.com>2010-04-13 03:53:50 +0000
commit523136f211c183f5e5c51adf00eb84cb838e7d0a (patch)
tree6ba606e88071d90e346f04db80306b1e11f2f665 /gdb/tracepoint.c
parent02067d243b6e0d2d10246f47740dd01c1da1c810 (diff)
downloadgdb-523136f211c183f5e5c51adf00eb84cb838e7d0a.zip
gdb-523136f211c183f5e5c51adf00eb84cb838e7d0a.tar.gz
gdb-523136f211c183f5e5c51adf00eb84cb838e7d0a.tar.bz2
2010-04-12 Stan Shebs <stan@codesourcery.com>
* tracepoint.c (tfile_xfer_partial): Check read result.
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r--gdb/tracepoint.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index d3160a9..8222182 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3892,7 +3892,14 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object,
if (amt > len)
amt = len;
- read (trace_fd, readbuf, amt);
+ gotten = read (trace_fd, readbuf, amt);
+ if (gotten < 0)
+ perror_with_name (trace_filename);
+ /* While it's acceptable to return less than was
+ originally asked for, it's not acceptable to return
+ less than what this block claims to contain. */
+ else if (gotten < amt)
+ error (_("Premature end of file while reading trace file"));
return amt;
}
lseek (trace_fd, mlen, SEEK_CUR);