mirror of
https://github.com/samba-team/samba.git
synced 2025-08-30 17:49:30 +03:00
smbd: reopen logs on SIGHUP for notifyd and cleanupd
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Nov 11 15:34:28 UTC 2021 on sn-devel-184
This commit is contained in:
@ -403,6 +403,7 @@ static void notifyd_sig_hup_handler(struct tevent_context *ev,
|
||||
{
|
||||
DBG_NOTICE("notifyd: Reloading services after SIGHUP\n");
|
||||
reload_services(NULL, NULL, false);
|
||||
reopen_logs();
|
||||
}
|
||||
|
||||
static bool smbd_notifyd_init(struct messaging_context *msg, bool interactive,
|
||||
@ -410,10 +411,10 @@ static bool smbd_notifyd_init(struct messaging_context *msg, bool interactive,
|
||||
{
|
||||
struct tevent_context *ev = messaging_tevent_context(msg);
|
||||
struct tevent_req *req;
|
||||
struct tevent_signal *se = NULL;
|
||||
pid_t pid;
|
||||
NTSTATUS status;
|
||||
bool ok;
|
||||
struct tevent_signal *se;
|
||||
|
||||
if (interactive) {
|
||||
req = notifyd_req(msg, ev);
|
||||
@ -570,6 +571,17 @@ static void notifyd_started(struct tevent_req *req)
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanupd_sig_hup_handler(struct tevent_context *ev,
|
||||
struct tevent_signal *se,
|
||||
int signum,
|
||||
int count,
|
||||
void *siginfo,
|
||||
void *pvt)
|
||||
{
|
||||
DBG_NOTICE("cleanupd: Reloading services after SIGHUP\n");
|
||||
reopen_logs();
|
||||
}
|
||||
|
||||
static void cleanupd_stopped(struct tevent_req *req);
|
||||
|
||||
static bool cleanupd_init(struct messaging_context *msg, bool interactive,
|
||||
@ -577,6 +589,7 @@ static bool cleanupd_init(struct messaging_context *msg, bool interactive,
|
||||
{
|
||||
struct tevent_context *ev = messaging_tevent_context(msg);
|
||||
struct server_id parent_id = messaging_server_id(msg);
|
||||
struct tevent_signal *se = NULL;
|
||||
struct tevent_req *req;
|
||||
pid_t pid;
|
||||
NTSTATUS status;
|
||||
@ -647,6 +660,17 @@ static bool cleanupd_init(struct messaging_context *msg, bool interactive,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
se = tevent_add_signal(ev,
|
||||
ev,
|
||||
SIGHUP,
|
||||
0,
|
||||
cleanupd_sig_hup_handler,
|
||||
NULL);
|
||||
if (se == NULL) {
|
||||
DBG_ERR("Could not add SIGHUP handler\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
req = smbd_cleanupd_send(msg, ev, msg, parent_id.pid);
|
||||
if (req == NULL) {
|
||||
DBG_WARNING("smbd_cleanupd_send failed\n");
|
||||
|
Reference in New Issue
Block a user