[Fwd: Re: [PATCH] s3: Fix max indentation and max column]

Andreas Schneider asn at samba.org
Mon Mar 12 19:24:11 UTC 2018


On Monday, 12 March 2018 20:22:57 CET Swen Schillig wrote:
> Sorry Christof, didn't read your other updates.
> 
> On Mon, 2018-03-12 at 12:15 -0700, Christof Schmitt via samba-technical 
wrote:
> > On Mon, Mar 12, 2018 at 08:10:42PM +0100, Swen Schillig wrote:
> > > Ok, integrated all suggested updates.
> > > 
> > > Thanks for your support.
> > 
> > Thank you.
> > 
> > > Cheers Swen
> > > From b3a7ee04b1552feda6137c1b3c48514a0289ad74 Mon Sep 17 00:00:00 2001
> > > From: Swen Schillig <swen at vnet.ibm.com>
> > > Date: Mon, 5 Mar 2018 12:55:23 +0100
> > > Subject: [PATCH] s3: Fix max indentation and max column
> > > 
> > > Minor cleanup reducing the max indentation level and max column length.
> > > 
> > > Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
> > > ---
> > > 
> > >  source3/smbd/dir.c | 45 +++++++++++++++++++++++++--------------------
> > >  1 file changed, 25 insertions(+), 20 deletions(-)
> > > 
> > > diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
> > > index 6621b4ee387..4c74094a6c5 100644
> > > --- a/source3/smbd/dir.c
> > > +++ b/source3/smbd/dir.c
> > > @@ -159,29 +159,34 @@ static struct dptr_struct *dptr_get(struct
> > > smbd_server_connection *sconn,> > 
> > >  				    int key, bool forclose)
> > >  
> > >  {
> > >  
> > >  	struct dptr_struct *dptr;
> > > 
> > > +	const int dirhandles_open = sconn->searches.dirhandles_open;
> > > 
> > > -	for(dptr = sconn->searches.dirptrs; dptr; dptr = dptr->next) {
> > > -		if(dptr->dnum == key) {
> > > -			if (!forclose && !dptr->dir_hnd) {
> > > -				if (sconn->searches.dirhandles_open >= 
MAX_OPEN_DIRECTORIES)
> > > -					dptr_idleoldest(sconn);
> > > -				DEBUG(4,("dptr_get: Reopening dptr key %d\n",key));
> > > -
> > > -				if (!(dptr->dir_hnd = OpenDir(NULL,
> > > -							dptr->conn,
> > > -							dptr->smb_dname,
> > > -							dptr->wcard,
> > > -							dptr->attr))) {
> > > -					DEBUG(4,("dptr_get: Failed to "
> > > -						"open %s (%s)\n",
> > > -						dptr->smb_dname->base_name,
> > > -						strerror(errno)));
> > > -					return NULL;
> > > -				}
> > > +	for (dptr = sconn->searches.dirptrs; dptr != NULL; dptr = dptr-
>next)
> > > {
> > > +		if(dptr->dnum != key) {
> > > +			continue;
> > > +		}
> > > +
> > > +		if (!forclose && (dptr->dir_hnd != NULL)) {
> > > +			if (dirhandles_open >= MAX_OPEN_DIRECTORIES) {
> > > +				dptr_idleoldest(sconn);
> > > +			}
> > > +			DBG_INFO("dptr_get: Reopening dptr key %d\n",key);
> > 
> > The DBG_* macros already prefix the function name, so that should be
> > removed:
> > 
> > DBG_INFO("Reopening dptr key %d\n", key);
> > 
> > > +
> > > +			dptr->dir_hnd = OpenDir(NULL,
> > > +						dptr->conn,
> > > +						dptr->smb_dname,
> > > +						dptr->wcard,
> > > +						dptr->attr);
> > > +
> > > +			if (dptr->dir_hnd == NULL) {
> > > +				DBG_INFO("dptr_get: Failed to open %s (%s)\n",
> > > +				      dptr->smb_dname->base_name,
> > > +				      strerror(errno));
> > 
> > DBG_INFO("Failed to open %s (%s)\n",
> > 
> >       dptr->smb_dname->base_name,
> >       strerror(errno));
> > > 
> > > +				return NULL;
> > > 
> > >  			}
> > > 
> > > -			DLIST_PROMOTE(sconn->searches.dirptrs,dptr);
> > > -			return dptr;
> > > 
> > >  		}
> > > 
> > > +		DLIST_PROMOTE(sconn->searches.dirptrs, dptr);
> > > +		return dptr;
> > > 
> > >  	}
> > >  	return(NULL);
> > >  
> > >  }
> > 
> > Christof
> 
> This has it all now.
> 
> Please review, again
> 
> Thanks.
> 
> Cheers Swen.

RB+

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





More information about the samba-technical mailing list