The branch, master has been updated
       via  40a0a90 lib: Use talloc_memdup in messaging_rec_dup
       via  8aa6765 lib: Simplify check_log_size
      from  bf1ad50 lib: Use talloc_zero_array instead of memset

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


- Log -----------------------------------------------------------------
commit 40a0a90d7f88a3c0cb3e7ef1e8b564497293573f
Author: Volker Lendecke <[email protected]>
Date:   Sat Dec 13 09:52:42 2014 +0100

    lib: Use talloc_memdup in messaging_rec_dup
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Sun Dec 28 04:20:48 CET 2014 on sn-devel-104

commit 8aa67651db4ae900e6996668a21595e7525221c6
Author: Volker Lendecke <[email protected]>
Date:   Mon Dec 15 12:09:11 2014 +0100

    lib: Simplify check_log_size
    
    Signed-off-by: Volker Lendecke <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

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

Summary of changes:
 lib/util/debug.c       | 8 +++-----
 source3/lib/messages.c | 3 +--
 2 files changed, 4 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/debug.c b/lib/util/debug.c
index b050205..a794c5b 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -708,18 +708,16 @@ void check_log_size( void )
                (void)reopen_logs_internal();
                if (state.fd > 2 && (fstat(state.fd, &st) == 0
                                     && st.st_size > maxlog)) {
-                       char *name = NULL;
+                       char name[strlen(state.debugf) + 5];
+
+                       snprintf(name, sizeof(name), "%s.old", state.debugf);
 
-                       if (asprintf(&name, "%s.old", state.debugf ) < 0) {
-                               return;
-                       }
                        (void)rename(state.debugf, name);
 
                        if (!reopen_logs_internal()) {
                                /* We failed to reopen a log - continue using 
the old name. */
                                (void)rename(name, state.debugf);
                        }
-                       SAFE_FREE(name);
                }
        }
 
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 7eadb02..0e53583 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -570,8 +570,7 @@ static struct messaging_rec *messaging_rec_dup(TALLOC_CTX 
*mem_ctx,
 
        result->fds = NULL;
        if (result->num_fds > 0) {
-               result->fds = talloc_array(result, int64_t, result->num_fds);
-               memcpy(result->fds, rec->fds, fds_size);
+               result->fds = talloc_memdup(result, rec->fds, fds_size);
        }
 
        return result;


-- 
Samba Shared Repository

Reply via email to