From 711364049338677a8792285f0c38c039344931ed Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 26 Oct 2023 18:45:33 +0200 Subject: [PATCH] =?utf8?q?fd-uitl:=20rename=20PIPE=5FEBADF=20=E2=86=92=20E?= =?utf8?q?BADF=5FPAIR,=20and=20add=20EBADF=5FTRIPLET?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We use it for more than just pipe() arrays. For example also for socketpair(). Hence let's give it a generic name. Also add EBADF_TRIPLET to mirror this for things like stdin/stdout/stderr arrays, which we use a bunch of times. --- src/basic/fd-util.c | 2 +- src/basic/fd-util.h | 5 ++++- src/basic/terminal-util.c | 4 ++-- src/core/automount.c | 2 +- src/core/dynamic-user.c | 2 +- src/core/exec-invoke.c | 4 ++-- src/core/execute.c | 8 ++++---- src/core/executor.c | 6 +++--- src/core/fuzz-execute-serialize.c | 6 +++--- src/core/manager.c | 2 +- src/core/service.c | 2 +- src/core/socket.c | 4 ++-- src/coredump/coredump.c | 2 +- src/fsck/fsck.c | 2 +- src/fuzz/fuzz-varlink.c | 2 +- src/import/import-common.c | 4 ++-- src/import/importd.c | 2 +- src/import/pull-common.c | 2 +- src/journal/fuzz-journald-stream.c | 2 +- src/libsystemd-network/fuzz-dhcp6-client.c | 2 +- src/libsystemd-network/fuzz-lldp-rx.c | 2 +- src/libsystemd-network/icmp6-util-unix.c | 2 +- src/libsystemd-network/test-dhcp6-client.c | 2 +- src/libsystemd-network/test-lldp-rx.c | 2 +- src/libsystemd/sd-bus/bus-container.c | 2 +- src/libsystemd/sd-bus/test-bus-benchmark.c | 2 +- src/libsystemd/sd-bus/test-bus-chat.c | 2 +- src/libsystemd/sd-daemon/sd-daemon.c | 2 +- src/libsystemd/sd-event/test-event.c | 8 ++++---- src/libsystemd/sd-login/test-login.c | 2 +- src/machine/image-dbus.c | 4 ++-- src/machine/machine-dbus.c | 8 ++++---- src/machine/machined-dbus.c | 2 +- src/nspawn/nspawn.c | 4 ++-- src/portable/portable.c | 2 +- src/portable/portabled-image-bus.c | 2 +- src/shared/data-fd-util.c | 4 ++-- src/shared/dissect-image.c | 2 +- src/shared/elf-util.c | 6 +++--- src/shared/logs-show.c | 2 +- src/shared/mount-util.c | 4 ++-- src/shared/pager.c | 2 +- src/shared/varlink.c | 2 +- src/shutdown/umount.c | 4 ++-- src/socket-proxy/socket-proxyd.c | 4 ++-- src/sysupdate/sysupdate-resource.c | 2 +- src/test/test-copy.c | 2 +- src/test/test-data-fd-util.c | 2 +- src/test/test-execute.c | 2 +- src/test/test-fd-util.c | 2 +- src/test/test-mempress.c | 2 +- src/test/test-namespace.c | 2 +- src/test/test-process-util.c | 2 +- src/test/test-socket-util.c | 2 +- src/test/test-varlink-idl.c | 2 +- src/test/test-varlink.c | 2 +- src/udev/udev-manager.c | 2 +- src/udev/udev-spawn.c | 2 +- 58 files changed, 86 insertions(+), 83 deletions(-) diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index 59c243e70d1..f2b606ea9b4 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -654,7 +654,7 @@ int rearrange_stdio(int original_input_fd, int original_output_fd, int original_ original_output_fd, original_error_fd }, null_fd = -EBADF, /* If we open /dev/null, we store the fd to it here */ - copy_fd[3] = { -EBADF, -EBADF, -EBADF }, /* This contains all fds we duplicate here + copy_fd[3] = EBADF_TRIPLET, /* This contains all fds we duplicate here * temporarily, and hence need to close at the end. */ r; bool null_readable, null_writable; diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h index b2efdc9c234..aba8f5f5af9 100644 --- a/src/basic/fd-util.h +++ b/src/basic/fd-util.h @@ -16,7 +16,10 @@ /* Make sure we can distinguish fd 0 and NULL */ #define FD_TO_PTR(fd) INT_TO_PTR((fd)+1) #define PTR_TO_FD(p) (PTR_TO_INT(p)-1) -#define PIPE_EBADF { -EBADF, -EBADF } + +/* Useful helpers for initializing pipe(), socketpair() or stdio fd arrays */ +#define EBADF_PAIR { -EBADF, -EBADF } +#define EBADF_TRIPLET { -EBADF, -EBADF, -EBADF } int close_nointr(int fd); int safe_close(int fd); diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 63594f07cf0..6cc6ff424ad 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -1191,7 +1191,7 @@ static int ptsname_namespace(int pty, char **ret) { int openpt_allocate_in_namespace(pid_t pid, int flags, char **ret_slave) { _cleanup_close_ int pidnsfd = -EBADF, mntnsfd = -EBADF, usernsfd = -EBADF, rootfd = -EBADF, fd = -EBADF; - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; pid_t child; int r; @@ -1244,7 +1244,7 @@ int openpt_allocate_in_namespace(pid_t pid, int flags, char **ret_slave) { int open_terminal_in_namespace(pid_t pid, const char *name, int mode) { _cleanup_close_ int pidnsfd = -EBADF, mntnsfd = -EBADF, usernsfd = -EBADF, rootfd = -EBADF; - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; pid_t child; int r; diff --git a/src/core/automount.c b/src/core/automount.c index 4de537fc423..14bf7e6998f 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -558,7 +558,7 @@ static void automount_trigger_notify(Unit *u, Unit *other) { } static void automount_enter_waiting(Automount *a) { - _cleanup_close_pair_ int pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipe_fd[2] = EBADF_PAIR; _cleanup_close_ int ioctl_fd = -EBADF; char name[STRLEN("systemd-") + DECIMAL_STR_MAX(pid_t) + 1]; _cleanup_free_ char *options = NULL; diff --git a/src/core/dynamic-user.c b/src/core/dynamic-user.c index 9e465791b31..76842e5f24c 100644 --- a/src/core/dynamic-user.c +++ b/src/core/dynamic-user.c @@ -79,7 +79,7 @@ static int dynamic_user_add(Manager *m, const char *name, int storage_socket[sta } static int dynamic_user_acquire(Manager *m, const char *name, DynamicUser** ret) { - _cleanup_close_pair_ int storage_socket[2] = PIPE_EBADF; + _cleanup_close_pair_ int storage_socket[2] = EBADF_PAIR; DynamicUser *d; int r; diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index 3b8cec8258b..9be39a56108 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -2080,7 +2080,7 @@ static int build_pass_environment(const ExecContext *c, char ***ret) { static int setup_private_users(uid_t ouid, gid_t ogid, uid_t uid, gid_t gid) { _cleanup_free_ char *uid_map = NULL, *gid_map = NULL; - _cleanup_close_pair_ int errno_pipe[2] = PIPE_EBADF; + _cleanup_close_pair_ int errno_pipe[2] = EBADF_PAIR; _cleanup_close_ int unshare_ready_fd = -EBADF; _cleanup_(sigkill_waitp) pid_t pid = 0; uint64_t c = 1; @@ -3906,7 +3906,7 @@ int exec_invoke( _cleanup_free_ int *fds = NULL; _cleanup_strv_free_ char **fdnames = NULL; - int socket_fd = -EBADF, named_iofds[3] = { -EBADF, -EBADF, -EBADF }, *params_fds = NULL; + int socket_fd = -EBADF, named_iofds[3] = EBADF_TRIPLET, *params_fds = NULL; size_t n_storage_fds = 0, n_socket_fds = 0; assert(command); diff --git a/src/core/execute.c b/src/core/execute.c index 35baac32249..f220e9ee5e8 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1994,8 +1994,8 @@ static int exec_shared_runtime_allocate(ExecSharedRuntime **ret, const char *id) *n = (ExecSharedRuntime) { .id = TAKE_PTR(id_copy), - .netns_storage_socket = PIPE_EBADF, - .ipcns_storage_socket = PIPE_EBADF, + .netns_storage_socket = EBADF_PAIR, + .ipcns_storage_socket = EBADF_PAIR, }; *ret = n; @@ -2057,7 +2057,7 @@ static int exec_shared_runtime_make( ExecSharedRuntime **ret) { _cleanup_(namespace_cleanup_tmpdirp) char *tmp_dir = NULL, *var_tmp_dir = NULL; - _cleanup_close_pair_ int netns_storage_socket[2] = PIPE_EBADF, ipcns_storage_socket[2] = PIPE_EBADF; + _cleanup_close_pair_ int netns_storage_socket[2] = EBADF_PAIR, ipcns_storage_socket[2] = EBADF_PAIR; int r; assert(m); @@ -2391,7 +2391,7 @@ int exec_runtime_make( ExecSharedRuntime *shared, DynamicCreds *creds, ExecRuntime **ret) { - _cleanup_close_pair_ int ephemeral_storage_socket[2] = PIPE_EBADF; + _cleanup_close_pair_ int ephemeral_storage_socket[2] = EBADF_PAIR; _cleanup_free_ char *ephemeral = NULL; _cleanup_(exec_runtime_freep) ExecRuntime *rt = NULL; int r; diff --git a/src/core/executor.c b/src/core/executor.c index 93ebad4b030..a7fb3112928 100644 --- a/src/core/executor.c +++ b/src/core/executor.c @@ -180,12 +180,12 @@ int main(int argc, char *argv[]) { _cleanup_(exec_command_done) ExecCommand command = {}; _cleanup_(exec_params_serialized_done) ExecParameters params = EXEC_PARAMETERS_INIT(/* flags= */ 0); _cleanup_(exec_shared_runtime_done) ExecSharedRuntime shared = { - .netns_storage_socket = PIPE_EBADF, - .ipcns_storage_socket = PIPE_EBADF, + .netns_storage_socket = EBADF_PAIR, + .ipcns_storage_socket = EBADF_PAIR, }; _cleanup_(dynamic_creds_done) DynamicCreds dynamic_creds = {}; _cleanup_(exec_runtime_clear) ExecRuntime runtime = { - .ephemeral_storage_socket = PIPE_EBADF, + .ephemeral_storage_socket = EBADF_PAIR, .shared = &shared, .dynamic_creds = &dynamic_creds, }; diff --git a/src/core/fuzz-execute-serialize.c b/src/core/fuzz-execute-serialize.c index a62a135fdfe..d71fb487e5a 100644 --- a/src/core/fuzz-execute-serialize.c +++ b/src/core/fuzz-execute-serialize.c @@ -39,11 +39,11 @@ static void exec_fuzz_one(FILE *f, FDSet *fdset) { DynamicCreds dynamic_creds = {}; ExecCommand command = {}; ExecSharedRuntime shared = { - .netns_storage_socket = PIPE_EBADF, - .ipcns_storage_socket = PIPE_EBADF, + .netns_storage_socket = EBADF_PAIR, + .ipcns_storage_socket = EBADF_PAIR, }; ExecRuntime runtime = { - .ephemeral_storage_socket = PIPE_EBADF, + .ephemeral_storage_socket = EBADF_PAIR, .shared = &shared, .dynamic_creds = &dynamic_creds, }; diff --git a/src/core/manager.c b/src/core/manager.c index a9cfe9a7fd8..6b9ce2d2ec4 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -911,7 +911,7 @@ int manager_new(RuntimeScope runtime_scope, ManagerTestRunFlags test_run_flags, .notify_fd = -EBADF, .cgroups_agent_fd = -EBADF, .signal_fd = -EBADF, - .user_lookup_fds = PIPE_EBADF, + .user_lookup_fds = EBADF_PAIR, .private_listen_fd = -EBADF, .dev_autofs_fd = -EBADF, .cgroup_inotify_fd = -EBADF, diff --git a/src/core/service.c b/src/core/service.c index 54090251a90..c63576ce790 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1532,7 +1532,7 @@ static int service_allocate_exec_fd( sd_event_source **ret_event_source, int *ret_exec_fd) { - _cleanup_close_pair_ int p[] = PIPE_EBADF; + _cleanup_close_pair_ int p[] = EBADF_PAIR; int r; assert(s); diff --git a/src/core/socket.c b/src/core/socket.c index bb7164d255b..55de5f96eb5 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1495,7 +1495,7 @@ static int socket_address_listen_in_cgroup( const char *label) { _cleanup_(pidref_done) PidRef pid = PIDREF_NULL; - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; int fd, r; assert(s); @@ -2986,7 +2986,7 @@ static int socket_accept_do(Socket *s, int fd) { static int socket_accept_in_cgroup(Socket *s, SocketPort *p, int fd) { _cleanup_(pidref_done) PidRef pid = PIDREF_NULL; - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; int cfd, r; assert(s); diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 40505e35f31..a67d425c14e 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -1402,7 +1402,7 @@ static int can_forward_coredump(pid_t pid) { static int forward_coredump_to_container(Context *context) { _cleanup_close_ int pidnsfd = -EBADF, mntnsfd = -EBADF, netnsfd = -EBADF, usernsfd = -EBADF, rootfd = -EBADF; - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; pid_t pid, child; struct ucred ucred = { .pid = context->pid, diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c index c0d0994e1b2..a09e7950cfc 100644 --- a/src/fsck/fsck.c +++ b/src/fsck/fsck.c @@ -234,7 +234,7 @@ static int fsck_progress_socket(void) { } static int run(int argc, char *argv[]) { - _cleanup_close_pair_ int progress_pipe[2] = PIPE_EBADF; + _cleanup_close_pair_ int progress_pipe[2] = EBADF_PAIR; _cleanup_(sd_device_unrefp) sd_device *dev = NULL; _cleanup_free_ char *dpath = NULL; _cleanup_fclose_ FILE *console = NULL; diff --git a/src/fuzz/fuzz-varlink.c b/src/fuzz/fuzz-varlink.c index 18db78ce983..dd63419ae11 100644 --- a/src/fuzz/fuzz-varlink.c +++ b/src/fuzz/fuzz-varlink.c @@ -85,7 +85,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { struct iovec server_iov = IOVEC_MAKE((void*) data, size), client_iov = IOVEC_MAKE((void*) data, size); /* Important: the declaration order matters here! we want that the fds are closed on return after the * event sources, hence we declare the fds first, the event sources second */ - _cleanup_close_pair_ int server_pair[2] = PIPE_EBADF, client_pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int server_pair[2] = EBADF_PAIR, client_pair[2] = EBADF_PAIR; _cleanup_(sd_event_source_unrefp) sd_event_source *idle_event_source = NULL, *server_event_source = NULL, *client_event_source = NULL; _cleanup_(varlink_server_unrefp) VarlinkServer *s = NULL; diff --git a/src/import/import-common.c b/src/import/import-common.c index 7227f885a8c..3a7a42c6b33 100644 --- a/src/import/import-common.c +++ b/src/import/import-common.c @@ -23,7 +23,7 @@ #include "tmpfile-util.h" int import_fork_tar_x(const char *path, pid_t *ret) { - _cleanup_close_pair_ int pipefd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipefd[2] = EBADF_PAIR; bool use_selinux; pid_t pid; int r; @@ -92,7 +92,7 @@ int import_fork_tar_x(const char *path, pid_t *ret) { } int import_fork_tar_c(const char *path, pid_t *ret) { - _cleanup_close_pair_ int pipefd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipefd[2] = EBADF_PAIR; bool use_selinux; pid_t pid; int r; diff --git a/src/import/importd.c b/src/import/importd.c index a58587beb26..c5b60c26041 100644 --- a/src/import/importd.c +++ b/src/import/importd.c @@ -357,7 +357,7 @@ static int transfer_on_log(sd_event_source *s, int fd, uint32_t revents, void *u } static int transfer_start(Transfer *t) { - _cleanup_close_pair_ int pipefd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipefd[2] = EBADF_PAIR; int r; assert(t); diff --git a/src/import/pull-common.c b/src/import/pull-common.c index a3d4bc8433a..44919a19c5e 100644 --- a/src/import/pull-common.c +++ b/src/import/pull-common.c @@ -380,7 +380,7 @@ static int verify_gpg( const void *payload, size_t payload_size, const void *signature, size_t signature_size) { - _cleanup_close_pair_ int gpg_pipe[2] = PIPE_EBADF; + _cleanup_close_pair_ int gpg_pipe[2] = EBADF_PAIR; char sig_file_path[] = "/tmp/sigXXXXXX", gpg_home[] = "/tmp/gpghomeXXXXXX"; _cleanup_(sigkill_waitp) pid_t pid = 0; bool gpg_home_created = false; diff --git a/src/journal/fuzz-journald-stream.c b/src/journal/fuzz-journald-stream.c index d4032cdc513..6b2055f2539 100644 --- a/src/journal/fuzz-journald-stream.c +++ b/src/journal/fuzz-journald-stream.c @@ -9,7 +9,7 @@ #include "fuzz-journald.h" #include "journald-stream.h" -static int stream_fds[2] = PIPE_EBADF; +static int stream_fds[2] = EBADF_PAIR; int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { Server s; diff --git a/src/libsystemd-network/fuzz-dhcp6-client.c b/src/libsystemd-network/fuzz-dhcp6-client.c index b879e1b4691..2d4284476c6 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] = PIPE_EBADF; +static int test_dhcp_fd[2] = EBADF_PAIR; 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 64f96ae2cbc..844957c069e 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] = PIPE_EBADF; +static int test_fd[2] = EBADF_PAIR; 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/icmp6-util-unix.c b/src/libsystemd-network/icmp6-util-unix.c index bbb3bc8cc6c..95e050083bf 100644 --- a/src/libsystemd-network/icmp6-util-unix.c +++ b/src/libsystemd-network/icmp6-util-unix.c @@ -7,7 +7,7 @@ #include "icmp6-util-unix.h" send_ra_t send_ra_function = NULL; -int test_fd[2] = PIPE_EBADF; +int test_fd[2] = EBADF_PAIR; static struct in6_addr dummy_link_local = { .s6_addr = { diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index bf9c3f409e0..109b23c6397 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] = PIPE_EBADF; +static int test_fd[2] = EBADF_PAIR; 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 387e1e2203a..feb53b520c1 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] = PIPE_EBADF; +static int test_fd[2] = EBADF_PAIR; static int lldp_rx_handler_calls; int lldp_network_bind_raw_socket(int ifindex) { diff --git a/src/libsystemd/sd-bus/bus-container.c b/src/libsystemd/sd-bus/bus-container.c index eddd634d8a6..71581d718cb 100644 --- a/src/libsystemd/sd-bus/bus-container.c +++ b/src/libsystemd/sd-bus/bus-container.c @@ -12,7 +12,7 @@ #include "string-util.h" int bus_container_connect_socket(sd_bus *b) { - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; _cleanup_close_ int pidnsfd = -EBADF, mntnsfd = -EBADF, usernsfd = -EBADF, rootfd = -EBADF; int r, error_buf = 0; pid_t child; diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c index 1eb6edd3291..74fa0ed746c 100644 --- a/src/libsystemd/sd-bus/test-bus-benchmark.c +++ b/src/libsystemd/sd-bus/test-bus-benchmark.c @@ -211,7 +211,7 @@ int main(int argc, char *argv[]) { MODE_CHART, } mode = MODE_BISECT; Type type = TYPE_LEGACY; - int i, pair[2] = PIPE_EBADF; + int i, pair[2] = EBADF_PAIR; _cleanup_free_ char *address = NULL, *server_name = NULL; _cleanup_close_ int bus_ref = -EBADF; const char *unique; diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c index 7abe129186b..4b457fd76ba 100644 --- a/src/libsystemd/sd-bus/test-bus-chat.c +++ b/src/libsystemd/sd-bus/test-bus-chat.c @@ -212,7 +212,7 @@ static void* client1(void *p) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; const char *hello; int r; - _cleanup_close_pair_ int pp[2] = PIPE_EBADF; + _cleanup_close_pair_ int pp[2] = EBADF_PAIR; char x; r = sd_bus_open_user(&bus); diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c index 7c370ab7bc4..6a60cde4bbc 100644 --- a/src/libsystemd/sd-daemon/sd-daemon.c +++ b/src/libsystemd/sd-daemon/sd-daemon.c @@ -615,7 +615,7 @@ _public_ int sd_pid_notify_with_fds( } _public_ int sd_pid_notify_barrier(pid_t pid, int unset_environment, uint64_t timeout) { - _cleanup_close_pair_ int pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipe_fd[2] = EBADF_PAIR; int r; if (pipe2(pipe_fd, O_CLOEXEC) < 0) diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c index fc918e3b532..63d3ee7284d 100644 --- a/src/libsystemd/sd-event/test-event.c +++ b/src/libsystemd/sd-event/test-event.c @@ -199,8 +199,8 @@ static void test_basic_one(bool with_pidfd) { sd_event *e = NULL; sd_event_source *w = NULL, *x = NULL, *y = NULL, *z = NULL, *q = NULL, *t = NULL; static const char ch = 'x'; - int a[2] = PIPE_EBADF, b[2] = PIPE_EBADF, - d[2] = PIPE_EBADF, k[2] = PIPE_EBADF; + int a[2] = EBADF_PAIR, b[2] = EBADF_PAIR, + d[2] = EBADF_PAIR, k[2] = EBADF_PAIR; uint64_t event_now; int64_t priority; @@ -629,7 +629,7 @@ static int ratelimit_expired(sd_event_source *s, void *userdata) { } TEST(ratelimit) { - _cleanup_close_pair_ int p[2] = PIPE_EBADF; + _cleanup_close_pair_ int p[2] = EBADF_PAIR; _cleanup_(sd_event_unrefp) sd_event *e = NULL; _cleanup_(sd_event_source_unrefp) sd_event_source *s = NULL; uint64_t interval; @@ -841,7 +841,7 @@ TEST(leave_ratelimit) { bool expect_ratelimit = false, manually_left_ratelimit = false; _cleanup_(sd_event_source_unrefp) sd_event_source *s = NULL; _cleanup_(sd_event_unrefp) sd_event *e = NULL; - _cleanup_close_pair_ int pfd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pfd[2] = EBADF_PAIR; unsigned c = 0; int r; diff --git a/src/libsystemd/sd-login/test-login.c b/src/libsystemd/sd-login/test-login.c index fe4b52f6c68..819f86f7446 100644 --- a/src/libsystemd/sd-login/test-login.c +++ b/src/libsystemd/sd-login/test-login.c @@ -39,7 +39,7 @@ static const char *e(int r) { } TEST(login) { - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; _cleanup_free_ char *pp = NULL, *qq = NULL, *display_session = NULL, *cgroup = NULL, *display = NULL, *remote_user = NULL, *remote_host = NULL, diff --git a/src/machine/image-dbus.c b/src/machine/image-dbus.c index 336b42b7e51..aa4525ddbda 100644 --- a/src/machine/image-dbus.c +++ b/src/machine/image-dbus.c @@ -31,7 +31,7 @@ int bus_image_method_remove( void *userdata, sd_bus_error *error) { - _cleanup_close_pair_ int errno_pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int errno_pipe_fd[2] = EBADF_PAIR; Image *image = ASSERT_PTR(userdata); Manager *m = image->userdata; pid_t child; @@ -145,7 +145,7 @@ int bus_image_method_clone( void *userdata, sd_bus_error *error) { - _cleanup_close_pair_ int errno_pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int errno_pipe_fd[2] = EBADF_PAIR; Image *image = ASSERT_PTR(userdata); Manager *m = ASSERT_PTR(image->userdata); const char *new_name; diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index 09302c0deec..b9ac931cd45 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c @@ -223,7 +223,7 @@ int bus_machine_method_get_addresses(sd_bus_message *message, void *userdata, sd } case MACHINE_CONTAINER: { - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; _cleanup_free_ char *us = NULL, *them = NULL; _cleanup_close_ int netns_fd = -EBADF; const char *p; @@ -371,7 +371,7 @@ int bus_machine_method_get_os_release(sd_bus_message *message, void *userdata, s case MACHINE_CONTAINER: { _cleanup_close_ int mntns_fd = -EBADF, root_fd = -EBADF, pidns_fd = -EBADF; - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; _cleanup_fclose_ FILE *f = NULL; pid_t child; @@ -896,7 +896,7 @@ int bus_machine_method_bind_mount(sd_bus_message *message, void *userdata, sd_bu int bus_machine_method_copy(sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_free_ char *host_basename = NULL, *container_basename = NULL; const char *src, *dest, *host_path, *container_path; - _cleanup_close_pair_ int errno_pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int errno_pipe_fd[2] = EBADF_PAIR; CopyFlags copy_flags = COPY_REFLINK|COPY_MERGE|COPY_HARDLINKS; _cleanup_close_ int hostfd = -EBADF; Machine *m = ASSERT_PTR(userdata); @@ -1093,7 +1093,7 @@ int bus_machine_method_open_root_directory(sd_bus_message *message, void *userda case MACHINE_CONTAINER: { _cleanup_close_ int mntns_fd = -EBADF, root_fd = -EBADF; - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; pid_t child; r = namespace_open(m->leader.pid, NULL, &mntns_fd, NULL, NULL, &root_fd); diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index a12eb516cc5..9fec047385b 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -688,7 +688,7 @@ static int method_clean_pool(sd_bus_message *message, void *userdata, sd_bus_err REMOVE_HIDDEN, } mode; - _cleanup_close_pair_ int errno_pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int errno_pipe_fd[2] = EBADF_PAIR; _cleanup_close_ int result_fd = -EBADF; Manager *m = userdata; Operation *operation; diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index f1bb8796443..37a75134f92 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -4762,8 +4762,8 @@ static int run_container( _cleanup_(release_lock_file) LockFile uid_shift_lock = LOCK_FILE_INIT; _cleanup_close_ int etc_passwd_lock = -EBADF; _cleanup_close_pair_ int - fd_inner_socket_pair[2] = PIPE_EBADF, - fd_outer_socket_pair[2] = PIPE_EBADF; + fd_inner_socket_pair[2] = EBADF_PAIR, + fd_outer_socket_pair[2] = EBADF_PAIR; _cleanup_close_ int notify_socket = -EBADF, mntns_fd = -EBADF, fd_kmsg_fifo = -EBADF; _cleanup_(barrier_destroy) Barrier barrier = BARRIER_NULL; diff --git a/src/portable/portable.c b/src/portable/portable.c index 89d92007708..f283530dd93 100644 --- a/src/portable/portable.c +++ b/src/portable/portable.c @@ -369,7 +369,7 @@ static int portable_extract_by_path( else { _cleanup_(dissected_image_unrefp) DissectedImage *m = NULL; _cleanup_(rmdir_and_freep) char *tmpdir = NULL; - _cleanup_close_pair_ int seq[2] = PIPE_EBADF; + _cleanup_close_pair_ int seq[2] = EBADF_PAIR; _cleanup_(sigkill_waitp) pid_t child = 0; /* We now have a loopback block device, let's fork off a child in its own mount namespace, mount it diff --git a/src/portable/portabled-image-bus.c b/src/portable/portabled-image-bus.c index f271d36db54..1f61c3b8c42 100644 --- a/src/portable/portabled-image-bus.c +++ b/src/portable/portabled-image-bus.c @@ -484,7 +484,7 @@ int bus_image_common_remove( Image *image, sd_bus_error *error) { - _cleanup_close_pair_ int errno_pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int errno_pipe_fd[2] = EBADF_PAIR; _cleanup_(sigkill_waitp) pid_t child = 0; PortableState state; int r; diff --git a/src/shared/data-fd-util.c b/src/shared/data-fd-util.c index 2fac0a9f446..b939206d822 100644 --- a/src/shared/data-fd-util.c +++ b/src/shared/data-fd-util.c @@ -26,7 +26,7 @@ #define DATA_FD_TMP_LIMIT (1024U*1024U) int acquire_data_fd(const void *data, size_t size, unsigned flags) { - _cleanup_close_pair_ int pipefds[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipefds[2] = EBADF_PAIR; _cleanup_close_ int fd = -EBADF; int isz = 0, r; ssize_t n; @@ -206,7 +206,7 @@ int copy_data_fd(int fd) { /* Hmm, pity, this didn't fit. Let's fall back to /tmp then, see below */ } else { - _cleanup_close_pair_ int pipefds[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipefds[2] = EBADF_PAIR; int isz; /* If memfds aren't available, use a pipe. Set O_NONBLOCK so that we will get EAGAIN rather diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 0e1b7631130..3fb5b1b7450 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -3377,7 +3377,7 @@ int dissected_image_acquire_metadata(DissectedImage *m, DissectImageFlags extra_ }; _cleanup_strv_free_ char **machine_info = NULL, **os_release = NULL, **initrd_release = NULL, **sysext_release = NULL, **confext_release = NULL; - _cleanup_close_pair_ int error_pipe[2] = PIPE_EBADF; + _cleanup_close_pair_ int error_pipe[2] = EBADF_PAIR; _cleanup_(rmdir_and_freep) char *t = NULL; _cleanup_(sigkill_waitp) pid_t child = 0; sd_id128_t machine_id = SD_ID128_NULL; diff --git a/src/shared/elf-util.c b/src/shared/elf-util.c index 5a4d3bbb50b..24ed16e56b5 100644 --- a/src/shared/elf-util.c +++ b/src/shared/elf-util.c @@ -739,9 +739,9 @@ static int parse_elf(int fd, const char *executable, char **ret, JsonVariant **r } int parse_elf_object(int fd, const char *executable, bool fork_disable_dump, char **ret, JsonVariant **ret_package_metadata) { - _cleanup_close_pair_ int error_pipe[2] = PIPE_EBADF, - return_pipe[2] = PIPE_EBADF, - json_pipe[2] = PIPE_EBADF; + _cleanup_close_pair_ int error_pipe[2] = EBADF_PAIR, + return_pipe[2] = EBADF_PAIR, + json_pipe[2] = EBADF_PAIR; _cleanup_(json_variant_unrefp) JsonVariant *package_metadata = NULL; _cleanup_free_ char *buf = NULL; int r; diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index c90400b8195..d3053ceabbb 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -1671,7 +1671,7 @@ int add_matches_for_user_unit(sd_journal *j, const char *unit, uid_t uid) { } static int get_boot_id_for_machine(const char *machine, sd_id128_t *boot_id) { - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; _cleanup_close_ int pidnsfd = -EBADF, mntnsfd = -EBADF, rootfd = -EBADF; char buf[SD_ID128_UUID_STRING_MAX]; pid_t pid, child; diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index e497035d41a..b4bee7af857 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -852,7 +852,7 @@ static int mount_in_namespace_legacy( const ImagePolicy *image_policy, bool is_image) { - _cleanup_close_pair_ int errno_pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int errno_pipe_fd[2] = EBADF_PAIR; char mount_slave[] = "/tmp/propagate.XXXXXX", *mount_tmp, *mount_outside, *p; bool mount_slave_created = false, mount_slave_mounted = false, mount_tmp_created = false, mount_tmp_mounted = false, @@ -1079,7 +1079,7 @@ static int mount_in_namespace( bool is_image) { _cleanup_(dissected_image_unrefp) DissectedImage *img = NULL; - _cleanup_close_pair_ int errno_pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int errno_pipe_fd[2] = EBADF_PAIR; _cleanup_close_ int mntns_fd = -EBADF, root_fd = -EBADF, pidns_fd = -EBADF, chased_src_fd = -EBADF, new_mount_fd = -EBADF; _cleanup_free_ char *chased_src_path = NULL; diff --git a/src/shared/pager.c b/src/shared/pager.c index 2cd9a353e33..2e9c82cde77 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -83,7 +83,7 @@ static int no_quit_on_interrupt(int exe_name_fd, const char *less_opts) { } void pager_open(PagerFlags flags) { - _cleanup_close_pair_ int fd[2] = PIPE_EBADF, exe_name_pipe[2] = PIPE_EBADF; + _cleanup_close_pair_ int fd[2] = EBADF_PAIR, exe_name_pipe[2] = EBADF_PAIR; _cleanup_strv_free_ char **pager_args = NULL; _cleanup_free_ char *l = NULL; const char *pager, *less_opts; diff --git a/src/shared/varlink.c b/src/shared/varlink.c index 3ecc7502f37..ae3a1bee28f 100644 --- a/src/shared/varlink.c +++ b/src/shared/varlink.c @@ -420,7 +420,7 @@ int varlink_connect_address(Varlink **ret, const char *address) { } int varlink_connect_exec(Varlink **ret, const char *_command, char **_argv) { - _cleanup_close_pair_ int pair[2] = PIPE_EBADF; + _cleanup_close_pair_ int pair[2] = EBADF_PAIR; _cleanup_(sigkill_waitp) pid_t pid = 0; _cleanup_free_ char *command = NULL; _cleanup_strv_free_ char **argv = NULL; diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c index 70585523ae7..1a9b99d7618 100644 --- a/src/shutdown/umount.c +++ b/src/shutdown/umount.c @@ -241,7 +241,7 @@ static void log_umount_blockers(const char *mnt) { } static int remount_with_timeout(MountPoint *m, bool last_try) { - _cleanup_close_pair_ int pfd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pfd[2] = EBADF_PAIR; _cleanup_(sigkill_nowaitp) pid_t pid = 0; int r; @@ -297,7 +297,7 @@ static int remount_with_timeout(MountPoint *m, bool last_try) { } static int umount_with_timeout(MountPoint *m, bool last_try) { - _cleanup_close_pair_ int pfd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pfd[2] = EBADF_PAIR; _cleanup_(sigkill_nowaitp) pid_t pid = 0; int r; diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c index f336fbd55ed..287fd6c1814 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c @@ -488,8 +488,8 @@ static int add_connection_socket(Context *context, int fd) { .context = context, .server_fd = fd, .client_fd = -EBADF, - .server_to_client_buffer = PIPE_EBADF, - .client_to_server_buffer = PIPE_EBADF, + .server_to_client_buffer = EBADF_PAIR, + .client_to_server_buffer = EBADF_PAIR, }; r = set_ensure_put(&context->connections, NULL, c); diff --git a/src/sysupdate/sysupdate-resource.c b/src/sysupdate/sysupdate-resource.c index da657034ea3..197b530a022 100644 --- a/src/sysupdate/sysupdate-resource.c +++ b/src/sysupdate/sysupdate-resource.c @@ -267,7 +267,7 @@ static int download_manifest( size_t *ret_size) { _cleanup_free_ char *buffer = NULL, *suffixed_url = NULL; - _cleanup_close_pair_ int pfd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pfd[2] = EBADF_PAIR; _cleanup_fclose_ FILE *manifest = NULL; size_t size = 0; pid_t pid; diff --git a/src/test/test-copy.c b/src/test/test-copy.c index a46dd309bdf..f3144f0c073 100644 --- a/src/test/test-copy.c +++ b/src/test/test-copy.c @@ -254,7 +254,7 @@ TEST(copy_tree) { } TEST(copy_bytes) { - _cleanup_close_pair_ int pipefd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipefd[2] = EBADF_PAIR; _cleanup_close_ int infd = -EBADF; int r, r2; char buf[1024], buf2[1024]; diff --git a/src/test/test-data-fd-util.c b/src/test/test-data-fd-util.c index c5a4b084693..d3bb0e3f5f8 100644 --- a/src/test/test-data-fd-util.c +++ b/src/test/test-data-fd-util.c @@ -81,7 +81,7 @@ static void assert_equal_fd(int fd1, int fd2) { TEST(copy_data_fd) { _cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF; - _cleanup_close_pair_ int sfd[2] = PIPE_EBADF; + _cleanup_close_pair_ int sfd[2] = EBADF_PAIR; _cleanup_(sigkill_waitp) pid_t pid = -1; int r; diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 417e484fc98..6156c9caa70 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -585,7 +585,7 @@ static int find_libraries(const char *exec, char ***ret) { _cleanup_(sd_event_source_unrefp) sd_event_source *sigchld_source = NULL; _cleanup_(sd_event_source_unrefp) sd_event_source *stdout_source = NULL; _cleanup_(sd_event_source_unrefp) sd_event_source *stderr_source = NULL; - _cleanup_close_pair_ int outpipe[2] = PIPE_EBADF, errpipe[2] = PIPE_EBADF; + _cleanup_close_pair_ int outpipe[2] = EBADF_PAIR, errpipe[2] = EBADF_PAIR; _cleanup_strv_free_ char **libraries = NULL; _cleanup_free_ char *result = NULL; pid_t pid; diff --git a/src/test/test-fd-util.c b/src/test/test-fd-util.c index 67ec3e59f1f..9c74d88abc4 100644 --- a/src/test/test-fd-util.c +++ b/src/test/test-fd-util.c @@ -561,7 +561,7 @@ TEST(fd_reopen_condition) { TEST(take_fd) { _cleanup_close_ int fd1 = -EBADF, fd2 = -EBADF; - int array[2] = PIPE_EBADF, i = 0; + int array[2] = EBADF_PAIR, i = 0; assert_se(fd1 == -EBADF); assert_se(fd2 == -EBADF); diff --git a/src/test/test-mempress.c b/src/test/test-mempress.c index c11a55a67e1..69928f3de00 100644 --- a/src/test/test-mempress.c +++ b/src/test/test-mempress.c @@ -188,7 +188,7 @@ TEST(real_pressure) { _cleanup_(sd_event_source_unrefp) sd_event_source *es = NULL, *cs = NULL; _cleanup_(bus_wait_for_jobs_freep) BusWaitForJobs *w = NULL; _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; - _cleanup_close_pair_ int pipe_fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pipe_fd[2] = EBADF_PAIR; _cleanup_(sd_event_unrefp) sd_event *e = NULL; _cleanup_free_ char *scope = NULL; const char *object; diff --git a/src/test/test-namespace.c b/src/test/test-namespace.c index 1c99c69d5f0..130c870602f 100644 --- a/src/test/test-namespace.c +++ b/src/test/test-namespace.c @@ -83,7 +83,7 @@ TEST(tmpdir) { } static void test_shareable_ns(unsigned long nsflag) { - _cleanup_close_pair_ int s[2] = PIPE_EBADF; + _cleanup_close_pair_ int s[2] = EBADF_PAIR; pid_t pid1, pid2, pid3; int r, n = 0; siginfo_t si; diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c index 524bcceb970..22fb1fd2787 100644 --- a/src/test/test-process-util.c +++ b/src/test/test-process-util.c @@ -859,7 +859,7 @@ TEST(get_process_threads) { assert_se(r >= 0); if (r == 0) { - _cleanup_close_pair_ int pfd[2] = PIPE_EBADF, ppfd[2] = PIPE_EBADF; + _cleanup_close_pair_ int pfd[2] = EBADF_PAIR, ppfd[2] = EBADF_PAIR; pthread_t t, tt; char x; diff --git a/src/test/test-socket-util.c b/src/test/test-socket-util.c index 3372805aa18..b5fb437c5bb 100644 --- a/src/test/test-socket-util.c +++ b/src/test/test-socket-util.c @@ -333,7 +333,7 @@ TEST(pass_many_fds_contents_read) { "/tmp/test-socket-util-passfd-contents-read-XXXXXX", "/tmp/test-socket-util-passfd-contents-read-XXXXXX" }; - int tmpfds[3] = { -EBADF, -EBADF, -EBADF }; + int tmpfds[3] = EBADF_TRIPLET; pair[0] = safe_close(pair[0]); diff --git a/src/test/test-varlink-idl.c b/src/test/test-varlink-idl.c index ff3033a6b4d..670fc0515d7 100644 --- a/src/test/test-varlink-idl.c +++ b/src/test/test-varlink-idl.c @@ -296,7 +296,7 @@ static void* server_thread(void *userdata) { } TEST(validate_method_call) { - _cleanup_close_pair_ int fd[2] = PIPE_EBADF; + _cleanup_close_pair_ int fd[2] = EBADF_PAIR; _cleanup_(varlink_unrefp) Varlink *v = NULL; pthread_t t; diff --git a/src/test/test-varlink.c b/src/test/test-varlink.c index 8359ab18921..b66c5df8a1b 100644 --- a/src/test/test-varlink.c +++ b/src/test/test-varlink.c @@ -324,7 +324,7 @@ int main(int argc, char *argv[]) { _cleanup_(rm_rf_physical_and_freep) char *tmpdir = NULL; _cleanup_(json_variant_unrefp) JsonVariant *v = NULL; _cleanup_(sd_event_unrefp) sd_event *e = NULL; - _cleanup_close_pair_ int block_fds[2] = PIPE_EBADF; + _cleanup_close_pair_ int block_fds[2] = EBADF_PAIR; pthread_t t; const char *sp; diff --git a/src/udev/udev-manager.c b/src/udev/udev-manager.c index dab36c90579..697dc2f14f4 100644 --- a/src/udev/udev-manager.c +++ b/src/udev/udev-manager.c @@ -1197,7 +1197,7 @@ Manager* manager_new(void) { *manager = (Manager) { .inotify_fd = -EBADF, - .worker_watch = PIPE_EBADF, + .worker_watch = EBADF_PAIR, .log_level = LOG_INFO, .resolve_name_timing = RESOLVE_NAME_EARLY, .timeout_usec = 180 * USEC_PER_SEC, diff --git a/src/udev/udev-spawn.c b/src/udev/udev-spawn.c index f90b9c62a12..9501013d1c7 100644 --- a/src/udev/udev-spawn.c +++ b/src/udev/udev-spawn.c @@ -230,7 +230,7 @@ int udev_event_spawn( size_t ressize, bool *ret_truncated) { - _cleanup_close_pair_ int outpipe[2] = PIPE_EBADF, errpipe[2] = PIPE_EBADF; + _cleanup_close_pair_ int outpipe[2] = EBADF_PAIR, errpipe[2] = EBADF_PAIR; _cleanup_strv_free_ char **argv = NULL; char **envp = NULL; Spawn spawn; -- 2.39.5