mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
must be explicit when using unions otherwise size mispatch could occur (#4256)
* must be explicit when using unions otherwise size mispatch could occur * fixed formatting
This commit is contained in:
parent
7fbe13086a
commit
0a945a55c9
@ -217,7 +217,15 @@ SocketIpStatus IpSocket::handleZeroReturn() {
|
||||
SocketIpStatus IpSocket::setupSocketOptions(int socketFd) {
|
||||
// Iterate over the socket options and set them
|
||||
for (const auto& options : IP_SOCKET_OPTIONS) {
|
||||
if (setsockopt(socketFd, options.level, options.option, &options.value, sizeof(options.value))) {
|
||||
int status = 0;
|
||||
if (options.type == SOCK_OPT_INT) {
|
||||
status = setsockopt(socketFd, options.level, options.option, &options.value.intVal,
|
||||
sizeof(options.value.intVal));
|
||||
} else {
|
||||
status = setsockopt(socketFd, options.level, options.option, &options.value.sizeVal,
|
||||
sizeof(options.value.sizeVal));
|
||||
}
|
||||
if (status) {
|
||||
return SOCK_FAILED_TO_SET_SOCKET_OPTIONS;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user