Fixing the many DEBUG statements that have confusing info ...

Richard Sharpe realrichardsharpe at gmail.com
Sun Oct 11 04:09:03 UTC 2015


Hi folks,

I thought I would spend some time fixing DEBUG statements using this idiom:

@@ -705,8 +705,8 @@ static bool smbd_open_one_socket(struct smbd_parent_context
*parent,
        ifss,
        true);
  if (s->fd == -1) {
- DEBUG(0,("smbd_open_one_socket: open_socket_in: "
- "%s\n", strerror(errno)));
+ DEBUG(0,("%s: open_socket_in: %s\n",
+ __func__, strerror(errno)));
  TALLOC_FREE(s);
  /*
  * We ignore an error here, as we've done before

where we use %s and __func__.

However, then I looked at a log file, and saw the following:

[2015/09/27 03:37:05.961482, 10, pid=13547, effective(0, 0), real(0,
0)] ../source3/lib/messages_dgm.c:403(messaging_dgm_wipe)
  messaging_dgm_cleanup(12521) returned Resource temporarily unavailable

That is, we already print the source file name, line number and the
function name. (And the debug message the produced that has gotten out
of sync with the actual location.)

Why should we duplicate that info. Surely it is better to simply
eliminate the function names from DEBUG messages.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)



More information about the samba-technical mailing list