From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH iproute2 1/3] iplink: Improve index parameter handling Date: Mon, 18 Dec 2017 11:23:59 -0800 Message-ID: <20171218112359.1ef8db23@xeon-e3> References: <1513623248-7689-1-git-send-email-serhe.popovych@gmail.com> <1513623248-7689-2-git-send-email-serhe.popovych@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Serhey Popovych Return-path: Received: from mail-pg0-f54.google.com ([74.125.83.54]:37828 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934949AbdLRTYB (ORCPT ); Mon, 18 Dec 2017 14:24:01 -0500 Received: by mail-pg0-f54.google.com with SMTP id y6so9536482pgp.4 for ; Mon, 18 Dec 2017 11:24:01 -0800 (PST) In-Reply-To: <1513623248-7689-2-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, 18 Dec 2017 20:54:06 +0200 Serhey Popovych wrote: > diff --git a/ip/iplink.c b/ip/iplink.c > index 1e685cc..4f9c169 100644 > --- a/ip/iplink.c > +++ b/ip/iplink.c > @@ -586,8 +586,10 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, > *name = *argv; > } else if (strcmp(*argv, "index") == 0) { > NEXT_ARG(); > + if (*index) > + duparg("index", *argv); > *index = atoi(*argv); > - if (*index < 0) > + if (*index <= 0) Why not use strtoul instead of atoi?