<div dir="ltr"><div dir="ltr">On Thu, Mar 7, 2024 at 6:29 PM Johan Sjölen <<a href="mailto:jsjolen@openjdk.org">jsjolen@openjdk.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Trivial bug fix where we didn't check the return value of `uname(2)` on POSIX platforms. I checked callers of `get_host_name` and all wrap the calls in an `if` branch so they already handle failures.<br></blockquote><div><br></div><div>I notice you're checking for a return value of zero. Posix 1003.1 states something like<br><br>Upon successful completion, a non-negative value is returned. Otherwise, −1 is returned and errno is set to indicate the error.<br><br></div><div>So the correct check based on that would be != -1.<br><br></div><div>Linux and FreeBSD document returning 0 on success, but Solaris/illumos definitely returns 1<br>(and as the port maintainer there it would be nice to have this correct). I don't have an AIX box<br>right now but the existing uname(2) check within openjdk is for -1, eg<br><a href="https://github.com/openjdk/jdk/blob/master/src/hotspot/os/aix/os_aix.cpp#L2799">https://github.com/openjdk/jdk/blob/master/src/hotspot/os/aix/os_aix.cpp#L2799</a><br><br></div><div>Thanks,<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Regards,<br>
Johan<br>
<br>
-------------<br>
<br>
Commit messages:<br>
- Check the return value of uname<br>
<br>
Changes: <a href="https://git.openjdk.org/jdk/pull/18157/files" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/18157/files</a><br>
Webrev: <a href="https://webrevs.openjdk.org/?repo=jdk&pr=18157&range=00" rel="noreferrer" target="_blank">https://webrevs.openjdk.org/?repo=jdk&pr=18157&range=00</a><br>
Issue: <a href="https://bugs.openjdk.org/browse/JDK-8327621" rel="noreferrer" target="_blank">https://bugs.openjdk.org/browse/JDK-8327621</a><br>
Stats: 5 lines in 1 file changed: 2 ins; 0 del; 3 mod<br>
Patch: <a href="https://git.openjdk.org/jdk/pull/18157.diff" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/18157.diff</a><br>
Fetch: git fetch <a href="https://git.openjdk.org/jdk.git" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk.git</a> pull/18157/head:pull/18157<br>
<br>
PR: <a href="https://git.openjdk.org/jdk/pull/18157" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/18157</a><br>
</blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">-Peter Tribble<br><a href="http://www.petertribble.co.uk/" target="_blank">http://www.petertribble.co.uk/</a> - <a href="http://ptribble.blogspot.com/" target="_blank">http://ptribble.blogspot.com/</a></div></div>