1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

dont leak file descriptors when set recmdoe timesout

(This used to be ctdb commit fc8a364eb095ec11ca01246a583bf1dc53510141)
This commit is contained in:
Ronnie Sahlberg 2009-06-19 14:58:06 +10:00
parent d3c5fb4bd1
commit baead0fdcc

View File

@ -531,7 +531,13 @@ static int set_recmode_destructor(struct ctdb_set_recmode_state *state)
double l = timeval_elapsed(&state->start_time);
ctdb_reclock_latency(state->ctdb, "daemon reclock", &state->ctdb->statistics.reclock.ctdbd, l);
if (state->fd[0] != -1) {
state->fd[0] = -1;
}
if (state->fd[1] != -1) {
state->fd[1] = -1;
}
kill(state->child, SIGKILL);
return 0;
}
@ -645,6 +651,8 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
CTDB_NO_MEMORY(ctdb, state);
state->start_time = timeval_current();
state->fd[0] = -1;
state->fd[1] = -1;
if (ctdb->tunable.verify_recovery_lock == 0) {
/* dont need to verify the reclock file */
@ -693,6 +701,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
_exit(0);
}
close(state->fd[1]);
state->fd[1] = -1;
talloc_set_destructor(state, set_recmode_destructor);