[SCM] Samba Shared Repository - branch master updated
Michael Adam
obnox at samba.org
Mon Nov 11 08:09:02 MST 2013
The branch, master has been updated
via 0eaae1a README.Coding: Add __func__
via bbb5f66 smbd: Fix DEBUG in do_break_to_none
from 22af043 CVE-2013-4476: s4:libtls: check for safe permissions of tls private key file (key.pem)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 0eaae1a87fee60675d8d9f48f8a5f5cb583f0e14
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 1 12:04:38 2013 +0000
README.Coding: Add __func__
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>
Autobuild-User(master): Michael Adam <obnox at samba.org>
Autobuild-Date(master): Mon Nov 11 16:08:09 CET 2013 on sn-devel-104
commit bbb5f66bcd4f096f7b1281e4fda6fdb488f064bc
Author: Volker Lendecke <vl at samba.org>
Date: Fri Nov 1 11:55:43 2013 +0000
smbd: Fix DEBUG in do_break_to_none
The name of this function has changed, but the DEBUG statements have
not been adapted. This is the case in a lot of our code. With __func__
this problem goes away: __func__ is C99, and we also use it already.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>
-----------------------------------------------------------------------
Summary of changes:
README.Coding | 14 ++++++++++++++
source3/smbd/oplock.c | 14 ++++++--------
2 files changed, 20 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/README.Coding b/README.Coding
index 956a733..107856e 100644
--- a/README.Coding
+++ b/README.Coding
@@ -377,3 +377,17 @@ do not use them in new code.
The only exception is the test code that depends repeated use of calls
like CHECK_STATUS, CHECK_VAL and others.
+
+
+Function names in DEBUG statements
+----------------------------------
+
+Many DEBUG statements contain the name of the function they appear in. This is
+not a good idea, as this is prone to bitrot. Function names change, code
+moves, but the DEBUG statements are not adapted. Use %s and __func__ for this:
+
+Bad Example:
+ DEBUG(0, ("strstr_m: src malloc fail\n"));
+
+Good Example:
+ DEBUG(0, ("%s: src malloc fail\n", __func__));
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index b5d6b54..312855d 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -644,13 +644,12 @@ static void do_break_to_none(struct tevent_context *ctx,
lck = get_existing_share_mode_lock(talloc_tos(), state->id);
if (lck == NULL) {
- DEBUG(1, ("release_level_2_oplocks_on_change: failed to lock "
- "share mode entry for file %s.\n",
- file_id_string_tos(&state->id)));
+ DEBUG(1, ("%s: failed to lock share mode entry for file %s.\n",
+ __func__, file_id_string_tos(&state->id)));
goto done;
}
- DEBUG(10,("release_level_2_oplocks_on_change: num_share_modes = %d\n",
+ DEBUG(10,("%s: num_share_modes = %d\n", __func__,
lck->data->num_share_modes ));
for(i = 0; i < lck->data->num_share_modes; i++) {
@@ -672,8 +671,7 @@ static void do_break_to_none(struct tevent_context *ctx,
* NO_OPLOCK states. JRA.
*/
- DEBUG(10,("release_level_2_oplocks_on_change: "
- "share_entry[%i]->op_type == %d\n",
+ DEBUG(10,("%s: share_entry[%i]->op_type == %d\n", __func__,
i, share_entry->op_type ));
if (share_entry->op_type == NO_OPLOCK) {
@@ -682,9 +680,9 @@ static void do_break_to_none(struct tevent_context *ctx,
/* Paranoia .... */
if (EXCLUSIVE_OPLOCK_TYPE(share_entry->op_type)) {
- DEBUG(0,("release_level_2_oplocks_on_change: PANIC. "
+ DEBUG(0,("%s: PANIC. "
"share mode entry %d is an exlusive "
- "oplock !\n", i ));
+ "oplock !\n", __func__, i ));
TALLOC_FREE(lck);
abort();
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list