Skip to content

Commit 99b8e67

Browse files
author
George Wang
committed
Merge branch 'PHP-7.3' into PHP-7.4
2 parents b78ec58 + e981f5a commit 99b8e67

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
@@ -603,7 +603,7 @@ static int sapi_lsapi_activate()
603603
static sapi_module_struct lsapi_sapi_module =
604604
{
605605
"litespeed",
606-
"LiteSpeed V7.5",
606+
"LiteSpeed V7.6",
607607

608608
php_lsapi_startup, /* startup */
609609
php_module_shutdown_wrapper, /* shutdown */
@@ -680,6 +680,8 @@ static void lsapi_sigsegv( int signal )
680680
_exit(1);
681681
}
682682

683+
static int do_clean_shutdown = 1;
684+
683685
static int clean_onexit = 1;
684686

685687

@@ -755,18 +757,20 @@ static int lsapi_module_main(int show_source)
755757
return -1;
756758
}
757759

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

771775
if (show_source) {
772776
zend_syntax_highlighter_ini syntax_highlighter_ini;
@@ -1569,7 +1573,8 @@ int main( int argc, char * argv[] )
15691573

15701574
int result;
15711575

1572-
atexit(lsapi_atexit);
1576+
if (do_clean_shutdown)
1577+
atexit(lsapi_atexit);
15731578

15741579
while( ( result = LSAPI_Prefork_Accept_r( &g_req )) >= 0 ) {
15751580
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
@@ -1643,6 +1648,13 @@ static PHP_MINIT_FUNCTION(litespeed)
16431648
if (p && 0 == strcasecmp(p, "on"))
16441649
parse_user_ini = 1;
16451650

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

0 commit comments

Comments
 (0)