Fix cppcheck warnings in rotctld.c

pull/252/head
mdblack98 2020-05-05 09:26:40 -05:00
rodzic ab63348217
commit f0437aa575
1 zmienionych plików z 20 dodań i 17 usunięć

Wyświetl plik

@ -166,7 +166,6 @@ int main(int argc, char *argv[])
struct addrinfo hints, *result, *saved_result;
int sock_listen;
int reuseaddr = 1;
int sockopt;
char host[NI_MAXHOST];
char serv[NI_MAXSERV];
@ -175,9 +174,6 @@ int main(int argc, char *argv[])
pthread_attr_t attr;
#endif
struct handle_data *arg;
#if HAVE_SIGACTION
struct sigaction act;
#endif
while (1)
{
@ -416,12 +412,16 @@ int main(int argc, char *argv[])
exit(1);
}
sockopt = SO_SYNCHRONOUS_NONALERT;
setsockopt(INVALID_SOCKET,
SOL_SOCKET,
SO_OPENTYPE,
(char *)&sockopt,
sizeof(sockopt));
{
// braced to prevent cppcheck warning
int sockopt = SO_SYNCHRONOUS_NONALERT;
setsockopt(INVALID_SOCKET,
SOL_SOCKET,
SO_OPENTYPE,
(char *)&sockopt,
sizeof(sockopt));
}
#endif
/*
@ -471,7 +471,7 @@ int main(int argc, char *argv[])
{
/* allow IPv4 mapped to IPv6 clients, MS & BSD default this
to 1 i.e. disallowed */
sockopt = 0;
int sockopt = 0;
if (setsockopt(sock_listen,
IPPROTO_IPV6,
@ -522,13 +522,16 @@ int main(int argc, char *argv[])
that will consequently fail with EPIPE. All child threads will
inherit this disposition which is what we want. */
#if HAVE_SIGACTION
memset(&act, 0, sizeof act);
act.sa_handler = SIG_IGN;
act.sa_flags = SA_RESTART;
if (sigaction(SIGPIPE, &act, NULL))
{
handle_error(RIG_DEBUG_ERR, "sigaction");
struct sigaction act;
memset(&act, 0, sizeof act);
act.sa_handler = SIG_IGN;
act.sa_flags = SA_RESTART;
if (sigaction(SIGPIPE, &act, NULL))
{
handle_error(RIG_DEBUG_ERR, "sigaction");
}
}
#elif HAVE_SIGNAL