changeset 51788:c0f9161f591e

8210836: Build fails with warn_unused_result in openjdk/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c Summary: Read in and process the return value of pread() while dealing with the PT_INTERP segment Reviewed-by: stuefe, jcbeyler
author jgeorge
date Tue, 18 Sep 2018 23:20:17 +0530
parents ba51515b64e5
children 0535b5a54b83
files src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Tue Sep 18 10:43:01 2018 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Tue Sep 18 23:20:17 2018 +0530
@@ -795,7 +795,11 @@
       if (exec_php->p_filesz > BUF_SIZE) {
         goto err;
       }
-      pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset);
+      if (pread(ph->core->exec_fd, interp_name,
+                exec_php->p_filesz, exec_php->p_offset) != exec_php->p_filesz) {
+        print_debug("Unable to read in the ELF interpreter\n");
+        goto err;
+      }
       interp_name[exec_php->p_filesz] = '\0';
       print_debug("ELF interpreter %s\n", interp_name);
       // read interpreter segments as well