aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-10-19 18:12:03 +0100
committerPedro Alves <palves@redhat.com>2017-10-19 18:12:03 +0100
commit63929e843d54d327676bed4d86dad280f4675547 (patch)
tree9ebbe7608bb2652ed3e634818f70587d1f557163
parent9d06997adb88a71487a2f5627de032c6fb994604 (diff)
downloadgdb-63929e843d54d327676bed4d86dad280f4675547.zip
gdb-63929e843d54d327676bed4d86dad280f4675547.tar.gz
gdb-63929e843d54d327676bed4d86dad280f4675547.tar.bz2
Fix build breakage in gdb/xml-support.c
The buildbots are showing that the previous change to xml_fetch_content_from_file causes __wur warnings/errors: ../../binutils-gdb/gdb/xml-support.c: In function gdb::unique_xmalloc_ptr<char> xml_fetch_content_from_file(const char*, void*): ../../binutils-gdb/gdb/xml-support.c:1028:43: error: ignoring return value of size_t fread(void*, size_t, size_t, FILE*), declared with attribute warn_unused_result [-Werror=unused-result] fread (text.get (), 1, len, file.get ()); ^ This commit fixes it. gdb/ChangeLog: 2017-10-19 Pedro Alves <palves@redhat.com> * xml-support.c (xml_fetch_content_from_file): Check fread's return.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/xml-support.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6625a03..aaf0485 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2017-10-19 Pedro Alves <palves@redhat.com>
+ * xml-support.c (xml_fetch_content_from_file): Check fread's
+ return.
+
+2017-10-19 Pedro Alves <palves@redhat.com>
+
* ser-base.c (ser_base_read_error_fd): Delete the file handler if
async.
(handle_error_fd): New function.
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 1f53d7a..2b59180 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -1025,8 +1025,8 @@ xml_fetch_content_from_file (const char *filename, void *baton)
gdb::unique_xmalloc_ptr<char> text ((char *) xmalloc (len + 1));
- fread (text.get (), 1, len, file.get ());
- if (ferror (file.get ()))
+ if (fread (text.get (), 1, len, file.get ()) != len
+ || ferror (file.get ()))
{
warning (_("Read error from \"%s\""), filename);
return NULL;