RFR: JDK-8210836 : Build fails with warn_unused_result in openjdk/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c

Jini George jini.george at oracle.com
Tue Sep 18 17:26:03 UTC 2018


Hi JC,

Thank you for looking into this. Since we are reading the PT_INTERP 
segment in this case to get the path of the dynamic linker, and since 
p_filesz denotes the size of the segment (in this case, it would be the 
size of the string denoting the path of the dynamic linker), if we end 
up reading anything less than p_filesz, it should be an error. If 
pread() returns a zero denoting an EOF while we are reading in the 
PT_INTERP segment, I guess it would mean that we are dealing with a 
truncated or a possibly corrupted file.

Thanks!
Jini.


On 9/18/2018 7:46 PM, JC Beyler wrote:
> Hi Jini,
> 
> I was looking at the man page and am curious: it says that the method 
> returns 0 if the end-of-file is reached, does that never happen in this 
> case?
> 
> (seems like -1 is the error code and another call to pread in the file 
> just checks for <= 0; which also is weird since 0 just means end of file).
> 
> Thanks,
> Jc
> 
> On Tue, Sep 18, 2018 at 6:06 AM Thomas Stüfe <thomas.stuefe at gmail.com 
> <mailto:thomas.stuefe at gmail.com>> wrote:
> 
>     Looks good. Thanks for fixing.
> 
>     ..Thomas
> 
>     On Tue, Sep 18, 2018 at 1:52 PM, Jini George <jini.george at oracle.com
>     <mailto:jini.george at oracle.com>> wrote:
>      > Hi all,
>      >
>      > Please review the small change for fixing the build failure in
>      > src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c with
>      > -Werror=unused-result.
>      >
>      > https://bugs.openjdk.java.net/browse/JDK-8210836
>      > Webrev: http://cr.openjdk.java.net/~jgeorge/8210836/webrev.00/
>     <http://cr.openjdk.java.net/%7Ejgeorge/8210836/webrev.00/>
>      >
>      > A quick review would be appreciated.
>      >
>      > Thank you!
>      > Jini.
> 
> 
> 
> -- 
> 
> Thanks,
> Jc


More information about the serviceability-dev mailing list