1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

basic/socket-util: add hint to silence gcc's maybe-unitialized warning

[59/1551] Compiling C object src/basic/libbasic.a.p/socket-util.c.o
../src/basic/socket-util.c: In function ‘socket_get_mtu’:
../src/basic/socket-util.c:1393:16: warning: ‘mtu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1393 |         *ret = (size_t) mtu;
      |                ^~~~~~~~~~~~
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-03-31 11:06:41 +02:00
parent adf6d848df
commit befab2c40c

View File

@ -14,6 +14,7 @@
#include <sys/types.h>
#include <sys/un.h>
#include "errno-util.h"
#include "macro.h"
#include "missing_network.h"
#include "missing_socket.h"
@ -264,7 +265,7 @@ static inline int getsockopt_int(int fd, int level, int optname, int *ret) {
socklen_t sl = sizeof(v);
if (getsockopt(fd, level, optname, &v, &sl) < 0)
return -errno;
return negative_errno();
if (sl != sizeof(v))
return -EIO;