test: fix misplaced braces in strncmp call
PATCH 1/1 test: fix misplaced braces in strncmp call
This patch fixes two occurances where a call to strncmp had the closing brace in the wrong place. Changing this form:
if (strncmp(X,Y,sizeof(X) != 0)) which does a comparison of length 1, to if (strncmp(X,Y,sizeof(X)) != 0)
which does the correct length comparison and then compares the result to zero in the "if" part, as the author presumably originally intended.
--- app/test/test_devargs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
app/test/test_devargs.c +2 -2
@@ -90,9 +90,9 @@ test_devargs(void) goto fail; devargs =TAILQ_FIRST (&devargs_list);if (strncmp (devargs->virtual.drv_name,"eth_ring1" , -sizeof (devargs->virtual.drv_name) !=0 )) +sizeof (devargs->virtual.drv_name)) !=0 ) goto fail; -if (strncmp (devargs->args,"k1=val,k2=val2" ,sizeof (devargs->args) !=0 )) +if (strncmp (devargs->args,"k1=val,k2=val2" ,sizeof (devargs->args)) !=0 ) goto fail;free_devargs_list ();
Signature · 1 line
1.9.3
Olivier MATZ
Acked-byHi Bruce,
Quoted 21 lines · Bruce Richardson
This patch fixes two occurances where a call to strncmp had the closing brace in the wrong place. Changing this form:
if (strncmp(X,Y,sizeof(X) != 0)) which does a comparison of length 1, to if (strncmp(X,Y,sizeof(X)) != 0)which does the correct length comparison and then compares the result to zero in the "if" part, as the author presumably originally intended.
Reported-by Larry Wang <[email protected]>Signed-off-by Bruce Richardson <[email protected]>--- app/test/test_devargs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)app/test/test_devargs.c +0
-0@@ -90,9 +90,9 @@ test_devargs(void) goto fail;
app/test/test_devargs.c test_devargs(void) · line 98
Quoted 10 lines
app/test/test_devargs.c +2
-2devargs =TAILQ_FIRST (&devargs_list);if (strncmp (devargs->virtual.drv_name,"eth_ring1" , -sizeof (devargs->virtual.drv_name) !=0 )) +sizeof (devargs->virtual.drv_name)) !=0 ) goto fail; -if (strncmp (devargs->args,"k1=val,k2=val2" ,sizeof (devargs->args) !=0 )) +if (strncmp (devargs->args,"k1=val,k2=val2" ,sizeof (devargs->args)) !=0 ) goto fail;free_devargs_list ();
Nice catch!
Thomas Monjalon
AppliedQuoted 8 lines
Quoted 8 lines
This patch fixes two occurances where a call to strncmp had the closing brace in the wrong place. Changing this form:
if (strncmp(X,Y,sizeof(X) != 0)) which does a comparison of length 1, to if (strncmp(X,Y,sizeof(X)) != 0)which does the correct length comparison and then compares the result to zero in the "if" part, as the author presumably originally intended.
Quoted 6 lines
Quoted 2 lines
Reported-by Larry Wang <[email protected]>Signed-off-by Bruce Richardson <[email protected]>Nice catch!
Acked-by Olivier Matz <[email protected]>
Applied
Thanks
Signature · 1 line
Thomas