-
Bug
-
Resolution: Fixed
-
P2
-
8, 11, 12
-
b12
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8212065 | 11.0.2 | Jini George | P2 | Closed | Fixed | b01 |
This error
openjdk/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c:798:7: error: ignoring return value of 'pread', declared with attribute warn_unused_result [-Werror=unused-result]
pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
was seen while trying to build OpenJDK on an Ubuntu 18.04 VM with compiler
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 7.3.0 (at /usr/bin/gcc)
* C++ Compiler: Version 7.3.0 (at /usr/bin/g++)
This change fixes the problem:
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c
@@ -795,7 +795,9 @@
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) {
+ goto err;
+ }
interp_name[exec_php->p_filesz] = '\0';
print_debug("ELF interpreter %s\n", interp_name);
// read interpreter segments as well
openjdk/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c:798:7: error: ignoring return value of 'pread', declared with attribute warn_unused_result [-Werror=unused-result]
pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
was seen while trying to build OpenJDK on an Ubuntu 18.04 VM with compiler
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 7.3.0 (at /usr/bin/gcc)
* C++ Compiler: Version 7.3.0 (at /usr/bin/g++)
This change fixes the problem:
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c
@@ -795,7 +795,9 @@
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) {
+ goto err;
+ }
interp_name[exec_php->p_filesz] = '\0';
print_debug("ELF interpreter %s\n", interp_name);
// read interpreter segments as well
- backported by
-
JDK-8212065 Build fails with warn_unused_result in openjdk/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c
- Closed
- relates to
-
JDK-8213773 SA: '\0' terminate the interp_name string read in through pread for MacOS
- Open
-
JDK-8210647 libsaproc is being compiled without optimization
- Resolved