summaryrefslogtreecommitdiff
path: root/src/providers/ldap/ldap_child.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-03-01 16:41:14 +0100
committerStephen Gallagher <sgallagh@redhat.com>2012-03-06 15:29:18 -0500
commitee6e61781536a0ef34491cea74e91c36ee439df9 (patch)
treea3a2a17fa64b308c8521e5acc5c01bf06cae6332 /src/providers/ldap/ldap_child.c
parentb300bad539e9a9ad7f3a88dc91253afff0425cb6 (diff)
downloadsssd-ee6e61781536a0ef34491cea74e91c36ee439df9.tar.gz
sssd-ee6e61781536a0ef34491cea74e91c36ee439df9.tar.bz2
sssd-ee6e61781536a0ef34491cea74e91c36ee439df9.zip
krb5_child: set debugging sooner
Diffstat (limited to 'src/providers/ldap/ldap_child.c')
-rw-r--r--src/providers/ldap/ldap_child.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 66ceb14e..025236e5 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -366,7 +366,7 @@ int main(int argc, const char *argv[])
int opt;
int debug_fd = -1;
poptContext pc;
- TALLOC_CTX *main_ctx;
+ TALLOC_CTX *main_ctx = NULL;
uint8_t *buf = NULL;
ssize_t len = 0;
const char *ccname = NULL;
@@ -388,7 +388,7 @@ int main(int argc, const char *argv[])
POPT_TABLEEND
};
- /* Set debug level to invalid value so we can deside if -d 0 was used. */
+ /* Set debug level to invalid value so we can decide if -d 0 was used. */
debug_level = SSSDBG_INVALID;
pc = poptGetContext(argv[0], argc, argv, long_options, 0);
@@ -406,23 +406,29 @@ int main(int argc, const char *argv[])
CONVERT_AND_SET_DEBUG_LEVEL(debug_level);
- DEBUG(7, ("ldap_child started.\n"));
-
- main_ctx = talloc_new(NULL);
- if (main_ctx == NULL) {
- DEBUG(1, ("talloc_new failed.\n"));
- _exit(-1);
+ debug_prg_name = talloc_asprintf(NULL, "[sssd[ldap_child[%d]]]", getpid());
+ if (!debug_prg_name) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_asprintf failed.\n"));
+ goto fail;
}
- debug_prg_name = talloc_asprintf(main_ctx, "[sssd[ldap_child[%d]]]", getpid());
-
if (debug_fd != -1) {
ret = set_debug_file_from_fd(debug_fd);
if (ret != EOK) {
- DEBUG(1, ("set_debug_file_from_fd failed.\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, ("set_debug_file_from_fd failed.\n"));
}
}
+ DEBUG(SSSDBG_TRACE_FUNC, ("ldap_child started.\n"));
+
+ main_ctx = talloc_new(NULL);
+ if (main_ctx == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("talloc_new failed.\n"));
+ talloc_free(discard_const(debug_prg_name));
+ goto fail;
+ }
+ talloc_steal(main_ctx, debug_prg_name);
+
buf = talloc_size(main_ctx, sizeof(uint8_t)*IN_BUF_SIZE);
if (buf == NULL) {
DEBUG(1, ("talloc_size failed.\n"));