Hi!
On 11/11/2014 09:16 PM, Cyril Hrubis wrote:
> 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?
>
I do this in order to provide more choices for users, like tst_kvercmp.
Is it necessary? If it is not, I will send a new patch. Thanks!
Regards,
Xing Gu
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list