The branch, master has been updated
       via  614f5a0 README.Coding: codify line splitting on function calls
       via  b97d18f s3: Fix max indentation and max column
      from  9e954bc ctdb-tests: Don't use nc -d or -w options

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 614f5a041ea6e021c2ff9c4e462b0e22626c7f33
Author: Uri Simchoni <[email protected]>
Date:   Sat Mar 10 07:08:28 2018 +0200

    README.Coding: codify line splitting on function calls
    
    Signed-off-by: Uri Simchoni <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Tue Mar 13 01:48:21 CET 2018 on sn-devel-144

commit b97d18f0fe26310501a0d7ece93dff48859da6b1
Author: Swen Schillig <[email protected]>
Date:   Mon Mar 5 12:55:23 2018 +0100

    s3: Fix max indentation and max column
    
    Minor cleanup reducing the max indentation level and max column length.
    
    Signed-off-by: Swen Schillig <[email protected]>
    Reviewed-by: Andreas Schneider <[email protected]>
    Reviewed-by: Christof Schmitt <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 README.Coding      |  5 +++--
 source3/smbd/dir.c | 45 +++++++++++++++++++++++++--------------------
 2 files changed, 28 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/README.Coding b/README.Coding
index e89925c..054cf3f 100644
--- a/README.Coding
+++ b/README.Coding
@@ -99,6 +99,7 @@ BreakBeforeBraces: Linux
 AllowShortIfStatementsOnASingleLine: false
 IndentCaseLabels: false
 BinPackParameters: false
+BinPackArguments: false
 
 
 =========================
@@ -201,8 +202,8 @@ parameters across lines and not as encourage for gratuitous 
line
 splitting.  Never split a line before columns 70 - 79 unless you
 have a really good reason. Be smart about formatting.
 
-One exception to the previous rule is function declarations and
-definitions. In function declarations and definitions, either the
+One exception to the previous rule is function calls, declarations, and
+definitions. In function calls, declarations, and definitions, either the
 declaration is a one-liner, or each parameter is listed on its own
 line. The rationale is that if there are many parameters, each one
 should be on its own line to make tracking interface changes easier.
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 6621b4e..4480ec3 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("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("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);
 }


-- 
Samba Shared Repository

Reply via email to