diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-12-20 10:02:10 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-20 10:02:10 +0900 |
commit | 57e7af551edafa8ad840a26c28184bc6339e09ad (patch) | |
tree | 083f7070d545fac20aa2375426d9d0c3ac9fe1ac /src/libsystemd-network | |
parent | 8d8d4b092aa94803c01638a2a7343d12f2b2776c (diff) | |
parent | 351293b3bbea3623aa9f643272ca5936951e34da (diff) | |
download | systemd-57e7af551edafa8ad840a26c28184bc6339e09ad.tar.gz |
Merge pull request #25786 from keszybz/ebadf
Use -EBADF for fd initialization
Diffstat (limited to 'src/libsystemd-network')
-rw-r--r-- | src/libsystemd-network/fuzz-dhcp6-client.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/fuzz-lldp-rx.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/fuzz-ndisc-rs.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/lldp-network.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-client.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp-server.c | 6 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp6-client.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-ipv4acd.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-lldp-rx.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-lldp-tx.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-ndisc.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-radv.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/test-dhcp6-client.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/test-lldp-rx.c | 2 |
14 files changed, 16 insertions, 16 deletions
diff --git a/src/libsystemd-network/fuzz-dhcp6-client.c b/src/libsystemd-network/fuzz-dhcp6-client.c index a1c34365c0..7da285e54e 100644 --- a/src/libsystemd-network/fuzz-dhcp6-client.c +++ b/src/libsystemd-network/fuzz-dhcp6-client.c @@ -10,7 +10,7 @@ #include "fd-util.h" #include "fuzz.h" -static int test_dhcp_fd[2] = { -1, -1 }; +static int test_dhcp_fd[2] = { -EBADF, -EBADF }; int dhcp6_network_send_udp_socket(int s, struct in6_addr *server_address, const void *packet, size_t len) { return len; diff --git a/src/libsystemd-network/fuzz-lldp-rx.c b/src/libsystemd-network/fuzz-lldp-rx.c index 6419075a4a..00a98bbeb0 100644 --- a/src/libsystemd-network/fuzz-lldp-rx.c +++ b/src/libsystemd-network/fuzz-lldp-rx.c @@ -10,7 +10,7 @@ #include "fuzz.h" #include "lldp-network.h" -static int test_fd[2] = { -1, -1 }; +static int test_fd[2] = { -EBADF, -EBADF }; int lldp_network_bind_raw_socket(int ifindex) { if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) < 0) diff --git a/src/libsystemd-network/fuzz-ndisc-rs.c b/src/libsystemd-network/fuzz-ndisc-rs.c index b294611fab..b794e2ad42 100644 --- a/src/libsystemd-network/fuzz-ndisc-rs.c +++ b/src/libsystemd-network/fuzz-ndisc-rs.c @@ -11,7 +11,7 @@ #include "socket-util.h" #include "ndisc-internal.h" -static int test_fd[2] = { -1, -1 }; +static int test_fd[2] = { -EBADF, -EBADF }; int icmp6_bind_router_solicitation(int index) { assert_se(socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0, test_fd) >= 0); diff --git a/src/libsystemd-network/lldp-network.c b/src/libsystemd-network/lldp-network.c index 24edc371db..598669fe20 100644 --- a/src/libsystemd-network/lldp-network.c +++ b/src/libsystemd-network/lldp-network.c @@ -37,7 +37,7 @@ int lldp_network_bind_raw_socket(int ifindex) { .ll.sll_family = AF_PACKET, .ll.sll_ifindex = ifindex, }; - _cleanup_close_ int fd = -1; + _cleanup_close_ int fd = -EBADF; assert(ifindex > 0); diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 47b4cb121f..48174e7c4b 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -2207,7 +2207,7 @@ int sd_dhcp_client_new(sd_dhcp_client **ret, int anonymize) { .n_ref = 1, .state = DHCP_STATE_INIT, .ifindex = -1, - .fd = -1, + .fd = -EBADF, .mtu = DHCP_MIN_PACKET_SIZE, .port = DHCP_PORT_CLIENT, .anonymize = !!anonymize, diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 11ab2338ce..b5aff7d4fa 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -200,9 +200,9 @@ int sd_dhcp_server_new(sd_dhcp_server **ret, int ifindex) { *server = (sd_dhcp_server) { .n_ref = 1, - .fd_raw = -1, - .fd = -1, - .fd_broadcast = -1, + .fd_raw = -EBADF, + .fd = -EBADF, + .fd_broadcast = -EBADF, .address = htobe32(INADDR_ANY), .netmask = htobe32(INADDR_ANY), .ifindex = ifindex, diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 3f34b46280..29cd003506 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -1499,7 +1499,7 @@ int sd_dhcp6_client_new(sd_dhcp6_client **ret) { .ia_pd.type = SD_DHCP6_OPTION_IA_PD, .ifindex = -1, .request_ia = DHCP6_REQUEST_IA_NA | DHCP6_REQUEST_IA_PD, - .fd = -1, + .fd = -EBADF, .rapid_commit = true, }; diff --git a/src/libsystemd-network/sd-ipv4acd.c b/src/libsystemd-network/sd-ipv4acd.c index 9b11b2f160..d34c63e854 100644 --- a/src/libsystemd-network/sd-ipv4acd.c +++ b/src/libsystemd-network/sd-ipv4acd.c @@ -151,7 +151,7 @@ int sd_ipv4acd_new(sd_ipv4acd **ret) { .n_ref = 1, .state = IPV4ACD_STATE_INIT, .ifindex = -1, - .fd = -1, + .fd = -EBADF, }; *ret = TAKE_PTR(acd); diff --git a/src/libsystemd-network/sd-lldp-rx.c b/src/libsystemd-network/sd-lldp-rx.c index 0479cff5f5..03e8986049 100644 --- a/src/libsystemd-network/sd-lldp-rx.c +++ b/src/libsystemd-network/sd-lldp-rx.c @@ -405,7 +405,7 @@ int sd_lldp_rx_new(sd_lldp_rx **ret) { *lldp_rx = (sd_lldp_rx) { .n_ref = 1, - .fd = -1, + .fd = -EBADF, .neighbors_max = LLDP_DEFAULT_NEIGHBORS_MAX, .capability_mask = UINT16_MAX, }; diff --git a/src/libsystemd-network/sd-lldp-tx.c b/src/libsystemd-network/sd-lldp-tx.c index d2d24be089..2b822af01a 100644 --- a/src/libsystemd-network/sd-lldp-tx.c +++ b/src/libsystemd-network/sd-lldp-tx.c @@ -451,7 +451,7 @@ static int lldp_tx_create_packet(sd_lldp_tx *lldp_tx, size_t *ret_packet_size, u } static int lldp_tx_send_packet(sd_lldp_tx *lldp_tx, size_t packet_size, const uint8_t *packet) { - _cleanup_close_ int fd = -1; + _cleanup_close_ int fd = -EBADF; union sockaddr_union sa; ssize_t l; diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index 2cf0cebdeb..2e446fece3 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -171,7 +171,7 @@ int sd_ndisc_new(sd_ndisc **ret) { *nd = (sd_ndisc) { .n_ref = 1, - .fd = -1, + .fd = -EBADF, }; *ret = TAKE_PTR(nd); diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c index a3a5a21b3d..20458b9f97 100644 --- a/src/libsystemd-network/sd-radv.c +++ b/src/libsystemd-network/sd-radv.c @@ -37,7 +37,7 @@ int sd_radv_new(sd_radv **ret) { *ra = (sd_radv) { .n_ref = 1, - .fd = -1, + .fd = -EBADF, .lifetime_usec = RADV_DEFAULT_ROUTER_LIFETIME_USEC, }; diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index c3c89514f8..7344099e77 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test-dhcp6-client.c @@ -73,7 +73,7 @@ static const uint8_t server_id[] = { SERVER_ID_BYTES }; static const struct ether_addr mac = { .ether_addr_octet = { 'A', 'B', 'C', '1', '2', '3' }, }; -static int test_fd[2] = { -1, -1, }; +static int test_fd[2] = { -EBADF, -EBADF }; static int test_ifindex = 42; static unsigned test_client_sent_message_count = 0; static sd_dhcp6_client *client_ref = NULL; diff --git a/src/libsystemd-network/test-lldp-rx.c b/src/libsystemd-network/test-lldp-rx.c index 11049a85b9..7ec1ab1ee9 100644 --- a/src/libsystemd-network/test-lldp-rx.c +++ b/src/libsystemd-network/test-lldp-rx.c @@ -20,7 +20,7 @@ #define TEST_LLDP_TYPE_SYSTEM_NAME "systemd-lldp" #define TEST_LLDP_TYPE_SYSTEM_DESC "systemd-lldp-desc" -static int test_fd[2] = { -1, -1 }; +static int test_fd[2] = { -EBADF, -EBADF }; static int lldp_rx_handler_calls; int lldp_network_bind_raw_socket(int ifindex) { |