Hi, On 06/09/2015 02:44 PM, Cyril Hrubis wrote: > Hi! >> Signed-off-by: Alexey Kodanev <[email protected]> >> --- >> testcases/network/lib6/in6_02.c | 32 ++++++++++++++++++++++++++++++++ >> 1 files changed, 32 insertions(+), 0 deletions(-) >> >> diff --git a/testcases/network/lib6/in6_02.c >> b/testcases/network/lib6/in6_02.c >> index fea1827..dadb2a5 100644 >> --- a/testcases/network/lib6/in6_02.c >> +++ b/testcases/network/lib6/in6_02.c >> @@ -255,4 +255,36 @@ void initest(void) >> void setup(void) >> { >> TEST_PAUSE; >> + >> + tst_resm(TINFO, "get interface name from LHOST_IFACES var"); >> + >> + char *ifnames = getenv("LHOST_IFACES"); >> + >> + if (!ifnames) { >> + tst_resm(TWARN, "LHOST_IFACES not defined, default to eth0"); >> + return; >> + } > Hmm, why not to use sscanf() instead? > > sscanf(ifnames, "%ms", &name);
Agree, that would simplify the code! > > And even when we want to be compatible before glibc 2.7 (2007) we can > do: > > static char *name[256]; > > sscanf(ifnames, "%255s", &name); In the last case we don't modify pointer address so 'static char name[256]' is OK. I'll send a new version. Thanks, Alexey ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
