From 9eddf35d2dcdded1fd4c0b50c18246b0cb595d60 Mon Sep 17 00:00:00 2001 Message-Id: <9eddf35d2dcdded1fd4c0b50c18246b0cb595d60.1542120879.git.hahn@univention.de> From: Philipp Hahn Date: Tue, 13 Nov 2018 09:41:25 +0100 Subject: [PATCH] Bug #48030: Harmonize debugging output Organization: Univention GmbH, Bremen, Germany The log messages are from UDL not not related to LDAP, so use UV_DEBUG_LISTENER instead of UV_DEBUG_LDAP. --- management/univention-directory-listener/src/handlers.c | 2 +- management/univention-directory-listener/src/main.c | 10 +++++----- management/univention-directory-listener/src/transfile.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/management/univention-directory-listener/src/handlers.c b/management/univention-directory-listener/src/handlers.c index 70473dfc99..f7846749a5 100644 --- a/management/univention-directory-listener/src/handlers.c +++ b/management/univention-directory-listener/src/handlers.c @@ -268,7 +268,7 @@ static int handler_import(char *filename) { } else { rv = fscanf(state_fp, "%u", &handler->state); if (rv != 1) - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed reading %s: %s", state_filename, strerror(errno)); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed reading %s: %s", state_filename, strerror(errno)); fclose(state_fp); } diff --git a/management/univention-directory-listener/src/main.c b/management/univention-directory-listener/src/main.c index 0076892660..f5dc2bb952 100644 --- a/management/univention-directory-listener/src/main.c +++ b/management/univention-directory-listener/src/main.c @@ -146,11 +146,11 @@ static void daemonize(int lock_fd) { abort(); rv = write(fd, buf, rv); if (rv) - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to write %s: %s", pidfile, strerror(errno)); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to write %s: %s", pidfile, strerror(errno)); } rv = close(fd); if (rv) - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to close %s: %s", pidfile, strerror(errno)); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to close %s: %s", pidfile, strerror(errno)); // Set new file permissions umask(0); @@ -158,7 +158,7 @@ static void daemonize(int lock_fd) { // Change the working directory to the root directory rv = chdir("/"); if (rv) - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to change directory: %s", strerror(errno)); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to change directory: %s", strerror(errno)); if ((null = open("/dev/null", O_RDWR)) == -1) { univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "could not open /dev/null: %s", strerror(errno)); @@ -170,13 +170,13 @@ static void daemonize(int lock_fd) { dup2(log, STDERR_FILENO); rv = close(log); if (rv) - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to close /var/log/univention/listener.log: %s", strerror(errno)); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to close /var/log/univention/listener.log: %s", strerror(errno)); } else { dup2(null, STDERR_FILENO); } rv = close(null); if (rv) - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to close /dev/null: %s", strerror(errno)); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to close /dev/null: %s", strerror(errno)); // Close all open file descriptors for (fd = sysconf(_SC_OPEN_MAX); fd > STDERR_FILENO; fd--) diff --git a/management/univention-directory-listener/src/transfile.c b/management/univention-directory-listener/src/transfile.c index e7a8af8b93..68db3363f3 100644 --- a/management/univention-directory-listener/src/transfile.c +++ b/management/univention-directory-listener/src/transfile.c @@ -60,7 +60,7 @@ static FILE *fopen_lock(const char *name, const char *type, FILE **l_file) { snprintf(buf, sizeof(buf), "%s.lock", name); if ((*l_file = fopen(buf, "a")) == NULL) { - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Could not open lock file [%s]", buf); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Could not open lock file [%s]", buf); return NULL; } @@ -69,7 +69,7 @@ static FILE *fopen_lock(const char *name, const char *type, FILE **l_file) { int rc = lockf(l_fd, F_TLOCK, 0); if (!rc) break; - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_INFO, "Could not get lock for file [%s]; count=%d", buf, count); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_INFO, "Could not get lock for file [%s]; count=%d", buf, count); count++; if (count > listener_lock_count) { univention_debug(UV_DEBUG_TRANSFILE, UV_DEBUG_ERROR, "Could not get lock for file [%s]; exit", buf); @@ -79,11 +79,11 @@ static FILE *fopen_lock(const char *name, const char *type, FILE **l_file) { } if ((file = fopen(name, type)) == NULL) { - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Could not open file [%s]", name); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Could not open file [%s]", name); int rc = lockf(l_fd, F_ULOCK, 0); if (rc) - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_WARN, "Failed to unlock %s: %s", buf, strerror(errno)); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_WARN, "Failed to unlock %s: %s", buf, strerror(errno)); fclose(*l_file); *l_file = NULL; } @@ -105,7 +105,7 @@ static int fclose_lock(FILE **file, FILE **l_file) { int l_fd = fileno(*l_file); int rc = lockf(l_fd, F_ULOCK, 0); if (rc) - univention_debug(UV_DEBUG_LDAP, UV_DEBUG_ALL, "unlockf(): %d", rc); + univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "unlockf(): %d", rc); rv |= fclose(*l_file); *l_file = NULL; } -- 2.11.0