iproute2: Check getline() return code correctly
Subsystems (3)
PATCH 1/1 iproute2: Check getline() return code correctly
The current implementation is always false, no matter what happens.
Signed-off-by Petr Sabata <[email protected]>
--- lib/utils.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/utils.c +1 -1
@@ -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; }
Signature · 1 line
1.7.5.2
Quoted 12 lines · On Fri, 10 Jun 2011 14:49:27 +0200 Petr Sabata <[email protected]> wrote:
The current implementation is always false, no matter what happens.
Signed-off-by Petr Sabata <[email protected]>--- lib/utils.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)lib/utils.c +0
-0
lib/utils.c ssize_t getcmdline(char **linep, size_t *lenp, FILE *in) · line 708
Quoted 8 lines
lib/utils.c +1
-1@@ -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.