[LTP] [PATCH] lib: Migrate tst_get_unused_port to new API

Petr Vorel pvorel@suse.cz
Mon May 20 16:50:02 CEST 2019


Hi,

> Hi!
> Acked.
Thanks.

I'm sorry, current implementation is wrong as it does not print port :).
I'll push it with this diff (I guess we don't need new line for port,
although that's not problematic for shell usage like this:

port=$(tst_get_unused_port ipv${TST_IPVER} stream)

Kind regards,
Petr

--- a/testcases/lib/tst_get_unused_port.c
+++ b/testcases/lib/tst_get_unused_port.c
@@ -54,5 +54,6 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
-	return TST_GET_UNUSED_PORT(family, type);
+	printf("%d", TST_GET_UNUSED_PORT(family, type));
+	return 0;
 }


More information about the ltp mailing list