aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/tracepoint.c9
2 files changed, 12 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 865768b..51cdaa6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-12 Stan Shebs <stan@codesourcery.com>
+
+ * tracepoint.c (tfile_xfer_partial): Check read result.
+
2010-04-12 Mike Frysinger <vapier@gentoo.org>
* remote-m32r-sdi.c (m32r_files_info): Add const to local "file" var.
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);