summaryrefslogtreecommitdiffstats
path: root/src/udev
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-12-20 03:09:08 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-12-20 17:50:33 +0100
commit5bb1d7fbab469b350d132cbbd2c794ffacef1b81 (patch)
treea48b1d5b73e72593b922c67c3946c80121841db0 /src/udev
parenttree-wide: introduce PIPE_EBADF macro (diff)
downloadsystemd-5bb1d7fbab469b350d132cbbd2c794ffacef1b81.tar.xz
systemd-5bb1d7fbab469b350d132cbbd2c794ffacef1b81.zip
tree-wide: use -EBADF more
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/udev-ctrl.c6
-rw-r--r--src/udev/udev-event.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 625c4faad8..24180f9418 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -46,7 +46,7 @@ struct UdevCtrl {
};
int udev_ctrl_new_from_fd(UdevCtrl **ret, int fd) {
- _cleanup_close_ int sock = -1;
+ _cleanup_close_ int sock = -EBADF;
UdevCtrl *uctrl;
assert(ret);
@@ -64,7 +64,7 @@ int udev_ctrl_new_from_fd(UdevCtrl **ret, int fd) {
*uctrl = (UdevCtrl) {
.n_ref = 1,
.sock = fd >= 0 ? fd : TAKE_FD(sock),
- .sock_connect = -1,
+ .sock_connect = -EBADF,
.bound = fd >= 0,
};
@@ -217,7 +217,7 @@ static int udev_ctrl_connection_event_handler(sd_event_source *s, int fd, uint32
static int udev_ctrl_event_handler(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
UdevCtrl *uctrl = ASSERT_PTR(userdata);
- _cleanup_close_ int sock = -1;
+ _cleanup_close_ int sock = -EBADF;
struct ucred ucred;
int r;
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 0ca8d12163..7a59e7c759 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -815,7 +815,7 @@ int udev_event_spawn(
return log_device_error_errno(event->dev, r,
"Failed to fork() to execute command '%s': %m", cmd);
if (r == 0) {
- if (rearrange_stdio(-1, TAKE_FD(outpipe[WRITE_END]), TAKE_FD(errpipe[WRITE_END])) < 0)
+ if (rearrange_stdio(-EBADF, TAKE_FD(outpipe[WRITE_END]), TAKE_FD(errpipe[WRITE_END])) < 0)
_exit(EXIT_FAILURE);
(void) close_all_fds(NULL, 0);