net: dhcpv4_server: Fix positive error codes returned
errno values are positive, therefore they should be negated when assigned as return values for net_dhcpv4_server_start(). Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
8d4743d144
commit
f77c7a3d05
|
@ -1533,7 +1533,7 @@ int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr)
|
||||||
|
|
||||||
sock = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
sock = zsock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
if (sock < 0) {
|
if (sock < 0) {
|
||||||
ret = errno;
|
ret = -errno;
|
||||||
LOG_ERR("Failed to create DHCPv4 server socket, %d", ret);
|
LOG_ERR("Failed to create DHCPv4 server socket, %d", ret);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -1541,7 +1541,7 @@ int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr)
|
||||||
ret = zsock_setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, &ifreq,
|
ret = zsock_setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, &ifreq,
|
||||||
sizeof(ifreq));
|
sizeof(ifreq));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ret = errno;
|
ret = -errno;
|
||||||
LOG_ERR("Failed to bind DHCPv4 server socket with interface, %d",
|
LOG_ERR("Failed to bind DHCPv4 server socket with interface, %d",
|
||||||
ret);
|
ret);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1549,7 +1549,7 @@ int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr)
|
||||||
|
|
||||||
ret = zsock_bind(sock, (struct sockaddr *)&addr, sizeof(addr));
|
ret = zsock_bind(sock, (struct sockaddr *)&addr, sizeof(addr));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ret = errno;
|
ret = -errno;
|
||||||
LOG_ERR("Failed to bind DHCPv4 server socket, %d", ret);
|
LOG_ERR("Failed to bind DHCPv4 server socket, %d", ret);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue