From: Cyril Hrubis <chrubis@suse.cz>
To: Xing Gu <gux.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v2 1/2] containers: change check_iproute() behavior in netns/netns_helper.h
Date: Tue, 11 Nov 2014 14:16:18 +0100 [thread overview]
Message-ID: <20141111131618.GD29189@rei> (raw)
In-Reply-To: <1415609164-10297-1-git-send-email-gux.fnst@cn.fujitsu.com>
Hi!
> +static int check_iproute(int spe_ipver)
> {
> FILE *ipf;
> int n;
> - unsigned int ipver = 0;
> + unsigned int cur_ipver = 0;
> + int ret;
>
> ipf = popen("ip -V", "r");
> if (ipf == NULL)
> tst_brkm(TCONF, NULL,
> "Failed while opening pipe for iproute check");
>
> - n = fscanf(ipf, "ip utility, iproute2-ss%u", &ipver);
> - if (n < 1 || ipver < IPROUTE_MIN_VER)
> + n = fscanf(ipf, "ip utility, iproute2-ss%u", &cur_ipver);
> + if (n < 1) {
> + pclose(ipf);
> tst_brkm(TCONF, NULL,
> - "iproute tools do not support setting network namespaces");
> + "Failed while obtaining version for iproute check");
> + } else {
> + if (cur_ipver < spe_ipver)
> + ret = -1;
> + else if (cur_ipver == spe_ipver)
> + ret = 0;
> + else
> + ret = 1;
> + }
Again why bother with return value when all the testcases just needs to
know if ip is newer than some version?
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2014-11-11 13:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 7:24 [LTP] [PATCH] containers: fix exit status in netns_netlink.c Xing Gu
2014-11-06 8:24 ` Cyril Hrubis
2014-11-10 8:46 ` [LTP] [PATCH v2 1/2] containers: change check_iproute() behavior in netns/netns_helper.h Xing Gu
2014-11-10 8:46 ` [LTP] [PATCH v2 2/2] containers: fix exit status in netns/netns_netlink.c Xing Gu
2014-11-11 13:16 ` Cyril Hrubis [this message]
[not found] ` <5462BC16.7090709@cn.fujitsu.com>
2014-12-02 14:12 ` [LTP] [PATCH v2 1/2] containers: change check_iproute() behavior in netns/netns_helper.h Cyril Hrubis
2014-12-05 7:00 ` [LTP] [PATCH v3 " Xing Gu
2014-12-05 7:00 ` [LTP] [PATCH v3 2/2] containers: fix exit status in netns/netns_netlink.c Xing Gu
2014-12-17 14:36 ` [LTP] [PATCH v3 1/2] containers: change check_iproute() behavior in netns/netns_helper.h Cyril Hrubis
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=20141111131618.GD29189@rei \
--to=chrubis@suse.cz \
--cc=gux.fnst@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.