<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi!</p>
<p>That should make things more clear, thanks!</p>
<p>Reviewed-by: Christian Amann <a class="moz-txt-link-rfc2396E" href="mailto:camann@suse.com"><camann@suse.com></a><br>
</p>
<pre class="done" id="18/e0/13c14fd2948d7c59e306fb2c604bb98bcd72_3/0">
</pre>
<div class="moz-cite-prefix">On 07/06/2019 09:17, Petr Vorel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20190607071751.9225-1-pvorel@suse.cz">
<pre class="moz-quote-pre" wrap="">To prevent confusing [1]:
if you want to print the port you actually have to use
ntohs() function to convert it to the host endianity. And if you are
passing that value in the sockaddr_in structure you must not use the
htons() since the value is already in the correct byte order.
[1] <a class="moz-txt-link-freetext" href="http://lists.linux.it/pipermail/ltp/2019-June/012289.html">http://lists.linux.it/pipermail/ltp/2019-June/012289.html</a>
Signed-off-by: Petr Vorel <a class="moz-txt-link-rfc2396E" href="mailto:pvorel@suse.cz"><pvorel@suse.cz></a>
---
lib/safe_net.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/safe_net.c b/lib/safe_net.c
index 970a2aba3..abebd1899 100644
--- a/lib/safe_net.c
+++ b/lib/safe_net.c
@@ -373,6 +373,9 @@ int safe_gethostname(const char *file, const int lineno,
return rval;
}
+/*
+ * @return port in network byte order.
+ */
unsigned short tst_get_unused_port(const char *file, const int lineno,
void (cleanup_fn)(void), unsigned short family, int type)
{
</pre>
</blockquote>
</body>
</html>