All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iproute2: Check getline() return code correctly
@ 2011-06-10 12:49 Petr Sabata
  2011-07-11 17:37 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Sabata @ 2011-06-10 12:49 UTC (permalink / raw)
  To: netdev; +Cc: Petr Sabata

The current implementation is always false, no matter what happens.

Signed-off-by: Petr Sabata <contyk@redhat.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;
 		}
-- 
1.7.5.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iproute2: Check getline() return code correctly
  2011-06-10 12:49 [PATCH] iproute2: Check getline() return code correctly Petr Sabata
@ 2011-07-11 17:37 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2011-07-11 17:37 UTC (permalink / raw)
  To: Petr Sabata; +Cc: netdev

On Fri, 10 Jun 2011 14:49:27 +0200
Petr Sabata <contyk@redhat.com> wrote:

> The current implementation is always false, no matter what happens.
> 
> Signed-off-by: Petr Sabata <contyk@redhat.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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-11 17:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-10 12:49 [PATCH] iproute2: Check getline() return code correctly Petr Sabata
2011-07-11 17:37 ` Stephen Hemminger

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.