1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-26 19:39:53 +03:00

Merge PR #664: silence several coverity "issues"

This commit is contained in:
Davide Beatrici 2018-08-22 10:44:48 +02:00 committed by GitHub
commit 1b493cbf20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 16 deletions

View File

@ -5161,7 +5161,7 @@ void CiRpcAccepted(CLIENT *c, SOCK *s)
err = Endian32(err); err = Endian32(err);
SendAll(s, &err, sizeof(UINT), false); SendAll(s, &err, sizeof(UINT), false);
RecvAll(s, &err, sizeof(UINT), false); (void)RecvAll(s, &err, sizeof(UINT), false);
} }
return; return;
} }

View File

@ -1995,13 +1995,10 @@ LABEL_RESTART:
} }
Unlock(t->CancelLock); Unlock(t->CancelLock);
if (c != NULL)
{
Cancel(c); Cancel(c);
ReleaseCancel(c); ReleaseCancel(c);
} }
}
if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false) if (IsTubeConnected(ipc->Sock->RecvTube) == false || IsTubeConnected(ipc->Sock->SendTube) == false)
{ {

View File

@ -11292,9 +11292,9 @@ SOCK *NewUDP4(UINT port, IP *ip)
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0)
{ {
bool false_flag = false; bool false_flag = false;
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&false_flag, sizeof(bool)); (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&false_flag, sizeof(bool));
#ifdef SO_EXCLUSIVEADDRUSE #ifdef SO_EXCLUSIVEADDRUSE
setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&true_flag, sizeof(bool)); (void)setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&true_flag, sizeof(bool));
#endif // SO_EXCLUSIVEADDRUSE #endif // SO_EXCLUSIVEADDRUSE
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0)
{ {
@ -11389,9 +11389,9 @@ SOCK *NewUDP6(UINT port, IP *ip)
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0)
{ {
bool false_flag = false; bool false_flag = false;
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&false_flag, sizeof(bool)); (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&false_flag, sizeof(bool));
#ifdef SO_EXCLUSIVEADDRUSE #ifdef SO_EXCLUSIVEADDRUSE
setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&true_flag, sizeof(bool)); (void)setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char *)&true_flag, sizeof(bool));
#endif // SO_EXCLUSIVEADDRUSE #endif // SO_EXCLUSIVEADDRUSE
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0) if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) != 0)
{ {
@ -12995,7 +12995,7 @@ SOCK *ListenEx62(UINT port, bool local_only, bool enable_ca)
#ifdef OS_UNIX #ifdef OS_UNIX
// It is necessary to set the IPv6 Only flag on a UNIX system // It is necessary to set the IPv6 Only flag on a UNIX system
setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &true_flag, sizeof(true_flag)); (void)setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &true_flag, sizeof(true_flag));
#endif // OS_UNIX #endif // OS_UNIX
#ifdef OS_UNIX #ifdef OS_UNIX
@ -14472,9 +14472,9 @@ SOCK *ConnectEx4(char *hostname, UINT port, UINT timeout, bool *cancel_flag, cha
Zero(&ling, sizeof(ling)); Zero(&ling, sizeof(ling));
// Forced disconnection flag // Forced disconnection flag
#ifdef SO_DONTLINGER #ifdef SO_DONTLINGER
setsockopt(sock->socket, SOL_SOCKET, SO_DONTLINGER, (char *)&true_flag, sizeof(bool)); (void)setsockopt(sock->socket, SOL_SOCKET, SO_DONTLINGER, (char *)&true_flag, sizeof(bool));
#else // SO_DONTLINGER #else // SO_DONTLINGER
setsockopt(sock->socket, SOL_SOCKET, SO_LINGER, (char *)&false_flag, sizeof(bool)); (void)setsockopt(sock->socket, SOL_SOCKET, SO_LINGER, (char *)&false_flag, sizeof(bool));
#endif // SO_DONTLINGER #endif // SO_DONTLINGER
// setsockopt(sock->socket, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool)); // setsockopt(sock->socket, SOL_SOCKET, SO_REUSEADDR, (char *)&true_flag, sizeof(bool));

View File

@ -536,7 +536,7 @@ void UnixSolarisSleep(UINT msec)
p.fd = solaris_sleep_p1; p.fd = solaris_sleep_p1;
p.events = POLLIN; p.events = POLLIN;
poll(&p, 1, msec == INFINITE ? -1 : (int)msec); (void)poll(&p, 1, msec == INFINITE ? -1 : (int)msec);
} }
// Get the free space of the disk // Get the free space of the disk
@ -855,7 +855,7 @@ void UnixFreeSingleInstance(void *data)
(void)fcntl(o->fd, F_SETLK, &lock); (void)fcntl(o->fd, F_SETLK, &lock);
close(o->fd); close(o->fd);
remove(o->FileName); (void)remove(o->FileName);
Free(data); Free(data);
} }
@ -1261,7 +1261,7 @@ void UnixCloseIO()
close(0); close(0);
close(1); close(1);
close(2); close(2);
open("/dev/null", O_RDWR); (void)open("/dev/null", O_RDWR);
dup2(0, 1); dup2(0, 1);
dup2(0, 2); dup2(0, 2);
close_io_first = false; close_io_first = false;