[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110711103733.7190571b@nehalam.ftrdhcpuser.net>
Date: Mon, 11 Jul 2011 10:37:33 -0700
From: Stephen Hemminger <shemminger@...tta.com>
To: Petr Sabata <contyk@...hat.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] iproute2: Check getline() return code correctly
On Fri, 10 Jun 2011 14:49:27 +0200
Petr Sabata <contyk@...hat.com> wrote:
> The current implementation is always false, no matter what happens.
>
> Signed-off-by: Petr Sabata <contyk@...hat.com>
> ---
> lib/utils.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib/utils.c b/lib/utils.c
> index 1b42222..76cadea 100644
> --- a/lib/utils.c
> +++ b/lib/utils.c
> @@ -702,7 +702,7 @@ ssize_t getcmdline(char **linep, size_t *lenp, FILE *in)
> size_t len1 = 0;
> size_t cc1;
>
> - if ((cc1 = getline(&line1, &len1, in)) < 0) {
> + if ((cc1 = getline(&line1, &len1, in)) == (size_t)-1) {
> fprintf(stderr, "Missing continuation line\n");
> return cc1;
> }
The correct fix is to make cc1 a signed variable.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists