/* Handle the signal by unlinking socket and exiting */
-static void terminate(void)
+static void terminate(bool is_parent)
{
- char *path = NULL;
-
- /* Remove socket file */
- if (asprintf(&path, "%s/%s",
+ if (is_parent) {
+ /* When parent goes away we should
+ * remove the socket file. Not so
+ * when children terminate.
+ */
+ char *path = NULL;
+
+ if (asprintf(&path, "%s/%s",
get_winbind_pipe_dir(), WINBINDD_SOCKET_NAME) > 0) {
- unlink(path);
- SAFE_FREE(path);
+ unlink(path);
+ SAFE_FREE(path);
+ }
}
idmap_close();
}
/* check if TERM has been received */
-void winbind_check_sigterm(void)
+void winbind_check_sigterm(bool is_parent)
{
if (do_sigterm)
- terminate();
+ terminate(is_parent);
}
/* Process incoming clients on listen_sock. We use a tricky non-blocking,
/* Check signal handling things */
- winbind_check_sigterm();
+ winbind_check_sigterm(true);
winbind_check_sighup();
if (do_sigusr2) {
TALLOC_CTX *frame = talloc_stackframe();
/* check for signals */
- winbind_check_sigterm();
+ winbind_check_sigterm(false);
winbind_check_sighup();
run_events(winbind_event_context(), 0, NULL, NULL);
void request_ok(struct winbindd_cli_state *state);
void request_finished_cont(void *private_data, bool success);
void winbind_check_sighup(void);
-void winbind_check_sigterm(void);
+void winbind_check_sigterm(bool in_parent);
int main(int argc, char **argv, char **envp);
/* The following definitions come from winbindd/winbindd_ads.c */