Skip to content

Commit 8a977e0

Browse files
author
George Wang
committed
Merge branch 'PHP-7.4'
2 parents 424d34d + 99b8e67 commit 8a977e0

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

sapi/litespeed/lsapi_main.c

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static int sapi_lsapi_activate()
601601
static sapi_module_struct lsapi_sapi_module =
602602
{
603603
"litespeed",
604-
"LiteSpeed V7.5",
604+
"LiteSpeed V7.6",
605605

606606
php_lsapi_startup, /* startup */
607607
php_module_shutdown_wrapper, /* shutdown */
@@ -678,6 +678,8 @@ static void lsapi_sigsegv( int signal )
678678
_exit(1);
679679
}
680680

681+
static int do_clean_shutdown = 1;
682+
681683
static int clean_onexit = 1;
682684

683685

@@ -753,18 +755,20 @@ static int lsapi_module_main(int show_source)
753755
return -1;
754756
}
755757

756-
sigemptyset(&act.sa_mask);
757-
act.sa_flags = SA_NODEFER;
758-
act.sa_handler = lsapi_sigterm;
759-
sa_rc = sigaction( SIGINT, &act, NULL);
760-
sa_rc = sigaction( SIGQUIT, &act, NULL);
761-
sa_rc = sigaction( SIGILL, &act, NULL);
762-
sa_rc = sigaction( SIGABRT, &act, NULL);
763-
sa_rc = sigaction( SIGBUS, &act, NULL);
764-
sa_rc = sigaction( SIGSEGV, &act, NULL);
765-
sa_rc = sigaction( SIGTERM, &act, NULL);
766-
767-
clean_onexit = 0;
758+
if (do_clean_shutdown) {
759+
sigemptyset(&act.sa_mask);
760+
act.sa_flags = SA_NODEFER;
761+
act.sa_handler = lsapi_sigterm;
762+
sa_rc = sigaction( SIGINT, &act, NULL);
763+
sa_rc = sigaction( SIGQUIT, &act, NULL);
764+
sa_rc = sigaction( SIGILL, &act, NULL);
765+
sa_rc = sigaction( SIGABRT, &act, NULL);
766+
sa_rc = sigaction( SIGBUS, &act, NULL);
767+
sa_rc = sigaction( SIGSEGV, &act, NULL);
768+
sa_rc = sigaction( SIGTERM, &act, NULL);
769+
770+
clean_onexit = 0;
771+
}
768772

769773
if (show_source) {
770774
zend_syntax_highlighter_ini syntax_highlighter_ini;
@@ -1567,7 +1571,8 @@ int main( int argc, char * argv[] )
15671571

15681572
int result;
15691573

1570-
atexit(lsapi_atexit);
1574+
if (do_clean_shutdown)
1575+
atexit(lsapi_atexit);
15711576

15721577
while( ( result = LSAPI_Prefork_Accept_r( &g_req )) >= 0 ) {
15731578
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
@@ -1641,6 +1646,13 @@ static PHP_MINIT_FUNCTION(litespeed)
16411646
if (p && 0 == strcasecmp(p, "on"))
16421647
parse_user_ini = 1;
16431648

1649+
p = getenv("LSAPI_CLEAN_SHUTDOWN");
1650+
if (p) {
1651+
if (*p == '1' || 0 == strcasecmp(p, "on"))
1652+
do_clean_shutdown = 1;
1653+
else if (*p == '0' || 0 == strcasecmp(p, "off"))
1654+
do_clean_shutdown = 0;
1655+
}
16441656
/*
16451657
* mod_lsapi always sets this env var,
16461658
* so we can detect mod_lsapi mode with its presense.

0 commit comments

Comments
 (0)