summaryrefslogtreecommitdiff
path: root/src/core/automount.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-12-19 13:20:30 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-12-19 15:00:59 +0100
commit3401477982d09e0c9815ae5a69e56f43f187967e (patch)
treefdf3ce225df76b9e643835928dc29aeef02a51fc /src/core/automount.c
parenta5937dcf3902ecb90777f259f6e006292eb54251 (diff)
downloadsystemd-3401477982d09e0c9815ae5a69e56f43f187967e.tar.gz
tree-wide: use -EBADF also in pipe initializers
In some places, initialization is dropped when unnecesary.
Diffstat (limited to 'src/core/automount.c')
-rw-r--r--src/core/automount.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index d2976d6734..361034d7f4 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -573,7 +573,7 @@ static void automount_trigger_notify(Unit *u, Unit *other) {
static void automount_enter_waiting(Automount *a) {
_cleanup_close_ int ioctl_fd = -EBADF;
- int p[2] = { -1, -1 };
+ int pipe_fd[2] = { -EBADF, -EBADF };
char name[STRLEN("systemd-") + DECIMAL_STR_MAX(pid_t) + 1];
_cleanup_free_ char *options = NULL;
bool mounted = false;
@@ -600,18 +600,18 @@ static void automount_enter_waiting(Automount *a) {
goto fail;
}
- if (pipe2(p, O_CLOEXEC) < 0) {
+ if (pipe2(pipe_fd, O_CLOEXEC) < 0) {
r = -errno;
goto fail;
}
- r = fd_nonblock(p[0], true);
+ r = fd_nonblock(pipe_fd[0], true);
if (r < 0)
goto fail;
if (asprintf(
&options,
"fd=%i,pgrp="PID_FMT",minproto=5,maxproto=5,direct%s%s",
- p[1],
+ pipe_fd[1],
getpgrp(),
isempty(a->extra_options) ? "" : ",",
strempty(a->extra_options)) < 0) {
@@ -626,7 +626,7 @@ static void automount_enter_waiting(Automount *a) {
mounted = true;
- p[1] = safe_close(p[1]);
+ pipe_fd[1] = safe_close(pipe_fd[1]);
if (stat(a->where, &st) < 0) {
r = -errno;
@@ -647,13 +647,13 @@ static void automount_enter_waiting(Automount *a) {
if (r < 0)
goto fail;
- r = sd_event_add_io(UNIT(a)->manager->event, &a->pipe_event_source, p[0], EPOLLIN, automount_dispatch_io, a);
+ r = sd_event_add_io(UNIT(a)->manager->event, &a->pipe_event_source, pipe_fd[0], EPOLLIN, automount_dispatch_io, a);
if (r < 0)
goto fail;
(void) sd_event_source_set_description(a->pipe_event_source, "automount-io");
- a->pipe_fd = p[0];
+ a->pipe_fd = pipe_fd[0];
a->dev_id = st.st_dev;
automount_set_state(a, AUTOMOUNT_WAITING);
@@ -663,7 +663,7 @@ static void automount_enter_waiting(Automount *a) {
fail:
log_unit_error_errno(UNIT(a), r, "Failed to initialize automounter: %m");
- safe_close_pair(p);
+ safe_close_pair(pipe_fd);
if (mounted) {
r = repeat_unmount(a->where, MNT_DETACH|UMOUNT_NOFOLLOW);