s3-ldap: fix more callers of smbldap_dn_talloc() that were passing a NULL context.
[ira/wip.git] / source3 / lib / debug.c
index d64fcb66d989d56d05d56fa34fabf0466687b0e2..14aca3adad2fd63d79bb4a7a4eee038d05b3eb0d 100644 (file)
@@ -832,7 +832,7 @@ void check_log_size( void )
                /* map debug levels to syslog() priorities
                 * note that not all DEBUG(0, ...) calls are
                 * necessarily errors */
-               static int priority_map[] = {
+               static const int priority_map[4] = {
                        LOG_ERR,     /* 0 */
                        LOG_WARNING, /* 1 */
                        LOG_NOTICE,  /* 2 */
@@ -842,7 +842,7 @@ void check_log_size( void )
                char *msgbuf = NULL;
                int ret;
 
-               if( syslog_level >= ( sizeof(priority_map) / sizeof(priority_map[0]) ) || syslog_level < 0)
+               if( syslog_level >= ARRAY_SIZE(priority_map) || syslog_level < 0)
                        priority = LOG_DEBUG;
                else
                        priority = priority_map[syslog_level];
@@ -851,7 +851,7 @@ void check_log_size( void )
                ret = vasprintf(&msgbuf, format_str, ap);
                va_end(ap);
 
-               if (ret == -1) {
+               if (ret != -1) {
                        syslog(priority, "%s", msgbuf);
                }
                SAFE_FREE(msgbuf);