Skip to content

Commit

Permalink
Fix last commit to unbound
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Apr 20, 2014
1 parent 88a3de7 commit c1f06e0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/modules/rlm_unbound/rlm_unbound.c
Expand Up @@ -43,6 +43,8 @@ typedef struct rlm_unbound_t {
int fd, logfd[2];
FILE *logstream[2];
int pipe_inuse;

FILE *debug_stream;
} rlm_unbound_t;

/*
Expand Down Expand Up @@ -390,7 +392,6 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
int debug_method;
char *optval;
int debug_fd = -1;
FILE *debug_stream;
char k[64]; /* To silence const warns until newer unbound in distros */

inst->el = radius_event_list_corral(EVENT_CORRAL_AUX);
Expand Down Expand Up @@ -572,13 +573,13 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
goto error_nores;
}

debug_stream = fdopen(debug_fd, "w");
if (!debug_stream) {
inst->debug_stream = fdopen(debug_fd, "w");
if (!inst->debug_stream) {
ERROR("rlm_unbound (%s): error setting up log stream", inst->name);
goto error_nores;
}

res = ub_ctx_debugout(inst->ub, debug_stream);
res = ub_ctx_debugout(inst->ub, inst->debug_stream);
if (res) goto error;
break;

Expand Down Expand Up @@ -686,7 +687,6 @@ static int mod_instantiate(CONF_SECTION *conf, void *instance)
xlat_unregister(inst->xlat_ptr_name, xlat_ptr, inst);
goto error_nores;
}
close(debug_fd);
return 0;

error:
Expand Down Expand Up @@ -731,6 +731,10 @@ static int mod_detach(UNUSED void *instance)
fclose(inst->logstream[0]);
}

if (inst->debug_stream) {
fclose(inst->debug_stream);
}

return 0;
}

Expand Down

0 comments on commit c1f06e0

Please sign in to comment.