[PATCH] Some code cleanup in ldb test

Jeremy Allison jra at samba.org
Wed Jun 22 16:54:50 UTC 2016


On Wed, Jun 22, 2016 at 03:17:03PM +0200, Andreas Schneider wrote:
> Review and push appreciated!

LGTM. Pushed !


> 	-- andreas
> 
> -- 
> Andreas Schneider                   GPG-ID: CC014E3D
> Samba Team                             asn at samba.org
> www.samba.org

> From d43ba5d5eb38949ec2d098174f3a87961aa8c3c8 Mon Sep 17 00:00:00 2001
> From: Andreas Schneider <asn at samba.org>
> Date: Wed, 22 Jun 2016 15:15:05 +0200
> Subject: [PATCH] s3-torture: Do some code hygiene in the ldb test
> 
> Coverity is confused if in a expresion we use = and not ==.
> 
> Signed-off-by: Andreas Schneider <asn at samba.org>
> ---
>  source4/torture/ldb/ldb.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/source4/torture/ldb/ldb.c b/source4/torture/ldb/ldb.c
> index 6210419..7ea9726 100644
> --- a/source4/torture/ldb/ldb.c
> +++ b/source4/torture/ldb/ldb.c
> @@ -1084,8 +1084,9 @@ static bool torture_ldb_unpack(struct torture_context *torture)
>  	const char *ldif_text = dda1d01d_ldif;
>  	struct ldb_ldif ldif;
>  
> +	ldb = samba_ldb_init(mem_ctx, torture->ev, NULL, NULL, NULL);
>  	torture_assert(torture,
> -		       ldb = samba_ldb_init(mem_ctx, torture->ev, NULL, NULL, NULL),
> +		       ldb != NULL,
>  		       "Failed to init ldb");
>  
>  	torture_assert_int_equal(torture, ldb_unpack_data(ldb, &data, msg), 0,
> @@ -1111,12 +1112,14 @@ static bool torture_ldb_parse_ldif(struct torture_context *torture)
>  	struct ldb_val data = data_blob_const(dda1d01d_bin, sizeof(dda1d01d_bin));
>  	struct ldb_message *msg = ldb_msg_new(mem_ctx);
>  
> +	ldb = samba_ldb_init(mem_ctx, torture->ev, NULL,NULL,NULL);
>  	torture_assert(torture,
> -		       ldb=samba_ldb_init(mem_ctx, torture->ev, NULL,NULL,NULL),
> +		       ldb != NULL,
>  		       "Failed to init ldb");
>  
> +	ldif = ldb_ldif_read_string(ldb, &ldif_text);
>  	torture_assert(torture,
> -		       ldif = ldb_ldif_read_string(ldb, &ldif_text),
> +		       ldif != NULL,
>  		       "ldb_ldif_read_string failed");
>  	torture_assert_int_equal(torture, ldif->changetype, LDB_CHANGETYPE_NONE,
>  				 "changetype is incorrect");
> @@ -1147,8 +1150,9 @@ static bool torture_ldb_unpack_only_attr_list(struct torture_context *torture)
>  	const char *ldif_text;
>  	struct ldb_ldif ldif;
>  
> +	ldb = samba_ldb_init(mem_ctx, torture->ev, NULL, NULL, NULL);
>  	torture_assert(torture,
> -		       ldb=samba_ldb_init(mem_ctx, torture->ev, NULL, NULL, NULL),
> +		       ldb != NULL,
>  		       "Failed to init samba");
>  
>  	torture_assert_int_equal(torture,
> -- 
> 2.9.0
> 




More information about the samba-technical mailing list