diff --git a/master.c b/master.c index 9ef39d84..a0bd7cc7 100644 --- a/master.c +++ b/master.c @@ -176,9 +176,15 @@ void master_loop(char **argv, char **environ) { uwsgi_unix_signal(SIGHUP, grace_them_all); - uwsgi_unix_signal(SIGTERM, reap_them_all); + if (uwsgi.die_on_term) { + uwsgi_unix_signal(SIGTERM, kill_them_all); + uwsgi_unix_signal(SIGQUIT, reap_them_all); + } + else { + uwsgi_unix_signal(SIGTERM, reap_them_all); + uwsgi_unix_signal(SIGQUIT, kill_them_all); + } uwsgi_unix_signal(SIGINT, kill_them_all); - uwsgi_unix_signal(SIGQUIT, kill_them_all); uwsgi_unix_signal(SIGUSR1, stats); diff --git a/notify.c b/notify.c index 6ce80663..3d8c8a73 100644 --- a/notify.c +++ b/notify.c @@ -56,7 +56,7 @@ void uwsgi_systemd_init(char *systemd_socket) { if (sun->sun_path[0] == '@') sun->sun_path[0] = 0; msghdr = uwsgi_malloc(sizeof(struct msghdr)); - memset(msghdr, sizeof(struct msghdr), 0); + memset(msghdr, 0, sizeof(struct msghdr)); msghdr->msg_iov = uwsgi_malloc(sizeof(struct iovec)*3); memset(msghdr->msg_iov, 0, sizeof(struct iovec)*3); diff --git a/uwsgi.c b/uwsgi.c index 31e65c42..05f2e1c4 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -68,6 +68,7 @@ UWSGI_DECLARE_EMBEDDED_PLUGINS static struct option long_base_options[] = { {"vassals-inherit", required_argument, 0, LONG_ARGS_VASSALS_INHERIT}, {"reload-mercy", required_argument, 0, LONG_ARGS_RELOAD_MERCY}, {"exit-on-reload", no_argument, &uwsgi.exit_on_reload, 1}, + {"die-on-term", no_argument, &uwsgi.die_on_term, 1}, {"help", no_argument, 0, 'h'}, {"usage", no_argument, 0, 'h'}, {"reaper", no_argument, 0, 'r'}, diff --git a/uwsgi.h b/uwsgi.h index b3fae250..61518d26 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -835,6 +835,7 @@ struct uwsgi_server { unsigned int reloads; int master_as_root; + int die_on_term; int lazy;