dbwrap_tool: Simplify persistent/non-persistent check / dbwrap_tool: Avoid an unnecessary "else"

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Sep 4 08:33:16 UTC 2018


On Tue, Sep 04, 2018 at 09:11:32AM +1200, Andrew Bartlett wrote:
> > commit 02d448429cc7f715b34d42aa425b74a715221202
> > Author: Volker Lendecke <vl at samba.org>
> > Date:   Fri Aug 24 15:06:34 2018 +0200
> > 
> >     dbwrap_tool: Simplify persistent/non-persistent check
> >     
> >     Signed-off-by: Volker Lendecke <vl at samba.org>
> >     Reviewed-by: Ralph Boehme <slow at samba.org>
> 
> G'Day,
> 
> While each of these looks reasonable on its own, is this really the
> clearest (rather than cleverest) possible way this could have been
> constructed as a whole?

Enough is enough. Sorry for the trouble this caused.

Review appreciated!

Thanks, Volker

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de

Meet us at Storage Developer Conference (SDC)
Santa Clara, CA USA, September 24th-27th 2018
-------------- next part --------------
From 76a77e1fd385cf742642954a82224ee0badf4d56 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 4 Sep 2018 10:31:25 +0200
Subject: [PATCH] Revert "dbwrap_tool: Simplify persistent/non-persistent
 check"

This reverts commit 02d448429cc7f715b34d42aa425b74a715221202.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/utils/dbwrap_tool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index 9c27fdc1946..30d59f29f62 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -434,7 +434,9 @@ int main(int argc, const char **argv)
 		goto done;
 	}
 
-	if ((persistent + non_persistent) != 1) {
+	if ((persistent == 0 && non_persistent == 0) ||
+	    (persistent == 1 && non_persistent == 1))
+	{
 		d_fprintf(stderr, "ERROR: you must specify exactly one "
 			  "of --persistent and --non-persistent\n");
 		goto done;
-- 
2.11.0



More information about the samba-technical mailing list