Skip to content

Commit 22885e2

Browse files
committed
fix litespeed SAPI build warnings.
helpers only called on linux anyways, proper C calls prototypes.
1 parent 11b612a commit 22885e2

File tree

2 files changed

+55
-31
lines changed

2 files changed

+55
-31
lines changed

sapi/litespeed/lsapi_main.c

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ static void log_message (const char *fmt, ...)
537537
#define DEBUG_MESSAGE(fmt, ...)
538538
#endif
539539

540-
static int lsapi_activate_user_ini();
540+
static int lsapi_activate_user_ini(void);
541541

542-
static int sapi_lsapi_activate()
542+
static int sapi_lsapi_activate(void)
543543
{
544544
char *path, *server_name;
545545
size_t path_len, server_name_len;
@@ -677,7 +677,7 @@ static int do_clean_shutdown = 1;
677677
static int clean_onexit = 1;
678678

679679

680-
static void lsapi_clean_shutdown()
680+
static void lsapi_clean_shutdown(void)
681681
{
682682
struct sigaction act;
683683
int sa_rc;
@@ -689,15 +689,31 @@ static void lsapi_clean_shutdown()
689689
sigemptyset(&act.sa_mask);
690690
act.sa_flags = 0;
691691
act.sa_handler = lsapi_sigsegv;
692-
sa_rc = sigaction(SIGINT, &act, NULL);
693-
sa_rc = sigaction(SIGQUIT, &act, NULL);
694-
sa_rc = sigaction(SIGILL, &act, NULL);
695-
sa_rc = sigaction(SIGABRT, &act, NULL);
696-
sa_rc = sigaction(SIGBUS, &act, NULL);
697-
sa_rc = sigaction(SIGSEGV, &act, NULL);
698-
sa_rc = sigaction(SIGTERM, &act, NULL);
699-
700-
sa_rc = sigaction(SIGPROF, &act, NULL);
692+
if ((sa_rc = sigaction(SIGINT, &act, NULL)) < 0) {
693+
return;
694+
}
695+
if ((sa_rc = sigaction(SIGQUIT, &act, NULL)) < 0) {
696+
return;
697+
}
698+
if ((sa_rc = sigaction(SIGILL, &act, NULL)) < 0) {
699+
return;
700+
}
701+
if ((sa_rc = sigaction(SIGABRT, &act, NULL)) < 0) {
702+
return;
703+
}
704+
if ((sa_rc = sigaction(SIGBUS, &act, NULL)) < 0) {
705+
return;
706+
}
707+
if ((sa_rc = sigaction(SIGSEGV, &act, NULL)) < 0) {
708+
return;
709+
}
710+
if ((sa_rc = sigaction(SIGTERM, &act, NULL)) < 0) {
711+
return;
712+
}
713+
714+
if ((sa_rc = sigaction(SIGPROF, &act, NULL)) < 0) {
715+
return;
716+
}
701717
memset(&tmv, 0, sizeof(struct itimerval));
702718
tmv.it_value.tv_sec = 0;
703719
tmv.it_value.tv_usec = 100000;
@@ -738,7 +754,6 @@ static void lsapi_atexit(void)
738754
}
739755
}
740756

741-
742757
static int lsapi_module_main(int show_source)
743758
{
744759
struct sigaction act;
@@ -751,13 +766,28 @@ static int lsapi_module_main(int show_source)
751766
sigemptyset(&act.sa_mask);
752767
act.sa_flags = SA_NODEFER;
753768
act.sa_handler = lsapi_sigterm;
754-
sa_rc = sigaction( SIGINT, &act, NULL);
755-
sa_rc = sigaction( SIGQUIT, &act, NULL);
756-
sa_rc = sigaction( SIGILL, &act, NULL);
757-
sa_rc = sigaction( SIGABRT, &act, NULL);
758-
sa_rc = sigaction( SIGBUS, &act, NULL);
759-
sa_rc = sigaction( SIGSEGV, &act, NULL);
760-
sa_rc = sigaction( SIGTERM, &act, NULL);
769+
if ((sa_rc = sigaction( SIGINT, &act, NULL)) < 0) {
770+
return -1;
771+
}
772+
773+
if ((sa_rc = sigaction( SIGQUIT, &act, NULL)) < 0) {
774+
return -1;
775+
}
776+
if ((sa_rc = sigaction( SIGILL, &act, NULL)) < 0) {
777+
return -1;
778+
}
779+
if ((sa_rc = sigaction( SIGABRT, &act, NULL)) < 0) {
780+
return -1;
781+
}
782+
if ((sa_rc = sigaction( SIGBUS, &act, NULL)) < 0) {
783+
return -1;
784+
}
785+
if ((sa_rc = sigaction( SIGSEGV, &act, NULL)) < 0) {
786+
return -1;
787+
}
788+
if ((sa_rc = sigaction( SIGTERM, &act, NULL)) < 0) {
789+
return -1;
790+
}
761791

762792
clean_onexit = 0;
763793
}

sapi/litespeed/lsapilib.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ static int LSAPI_perror_r( LSAPI_Request * pReq, const char * pErr1, const char
922922
}
923923

924924

925+
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
925926
static int lsapi_lve_error( LSAPI_Request * pReq )
926927
{
927928
static const char * headers[] =
@@ -945,10 +946,8 @@ static int lsapi_lve_error( LSAPI_Request * pReq )
945946
return 0;
946947
}
947948

948-
949949
static int lsapi_enterLVE( LSAPI_Request * pReq, uid_t uid )
950950
{
951-
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
952951
if ( s_lve && uid ) //root user should not do that
953952
{
954953
uint32_t cookie;
@@ -962,16 +961,13 @@ static int lsapi_enterLVE( LSAPI_Request * pReq, uid_t uid )
962961
return -1;
963962
}
964963
}
965-
#endif
966964

967965
return 0;
968966
}
969967

970-
971968
static int lsapi_jailLVE( LSAPI_Request * pReq, uid_t uid, struct passwd * pw )
972969
{
973970
int ret = 0;
974-
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
975971
char error_msg[1024] = "";
976972
ret = (*fp_lve_jail)( pw, error_msg );
977973
if ( ret < 0 )
@@ -981,12 +977,10 @@ static int lsapi_jailLVE( LSAPI_Request * pReq, uid_t uid, struct passwd * pw )
981977
LSAPI_perror_r( pReq, "LSAPI: jail() failure.", NULL );
982978
return -1;
983979
}
984-
#endif
985980
return ret;
986981
}
987982

988983

989-
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
990984
static int lsapi_initLVE(void)
991985
{
992986
const char * pEnv;
@@ -1368,7 +1362,7 @@ static inline int lsapi_notify_pid( int fd )
13681362

13691363

13701364
static char s_conn_key_packet[16];
1371-
static inline int init_conn_key( int fd )
1365+
static inline __attribute__((unused)) int init_conn_key( int fd )
13721366
{
13731367
struct lsapi_packet_header * pHeader = (struct lsapi_packet_header *)s_conn_key_packet;
13741368
struct timeval tv;
@@ -3160,11 +3154,11 @@ static void lsapi_check_child_status( long tmCur )
31603154
//}
31613155

31623156

3163-
void set_skip_write()
3157+
void set_skip_write(void)
31643158
{ s_skip_write = 1; }
31653159

31663160

3167-
int is_enough_free_mem()
3161+
int is_enough_free_mem(void)
31683162
{
31693163
#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__gnu_linux__)
31703164
//minimum 1GB or 10% available free memory
@@ -3832,7 +3826,7 @@ void LSAPI_No_Check_ppid(void)
38323826
}
38333827

38343828

3835-
int LSAPI_Get_ppid()
3829+
int LSAPI_Get_ppid(void)
38363830
{
38373831
return(s_ppid);
38383832
}

0 commit comments

Comments
 (0)