public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Alexey Kodanev <alexey.kodanev@oracle.com>
Cc: vasily.isaenko@oracle.com, ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] lib6/in6_2: don't assume that machine has 'eth0' interface name
Date: Tue, 9 Jun 2015 13:44:51 +0200	[thread overview]
Message-ID: <20150609114450.GA26486@rei.suse.de> (raw)
In-Reply-To: <1431518085-8950-1-git-send-email-alexey.kodanev@oracle.com>

Hi!
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
>  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);

And even when we want to be compatible before glibc 2.7 (2007) we can
do:

static char *name[256];

sscanf(ifnames, "%255s", &name);

> +	tst_resm(TINFO, "change default 'eth0' name to '%s'", name);
> +	n2i[1].name = name;
>  }
> -- 
> 1.7.1
> 
> 
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud 
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      reply	other threads:[~2015-06-09 11:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 11:54 [LTP] [PATCH] lib6/in6_2: don't assume that machine has 'eth0' interface name Alexey Kodanev
2015-06-09 11:44 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150609114450.GA26486@rei.suse.de \
    --to=chrubis@suse.cz \
    --cc=alexey.kodanev@oracle.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=vasily.isaenko@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox