core/service: minor cleanup for service_add_fd_store

This commit is contained in:
Mike Yuan
2024-03-03 18:53:05 +08:00
parent 81b49b3c73
commit 0578371f53
+7 -7
View File
@@ -523,7 +523,8 @@ static int service_add_fd_store(Service *s, int fd_in, const char *name, bool do
if (fstat(fd, &st) < 0)
return -errno;
log_unit_debug(UNIT(s), "Trying to stash fd for dev=" DEVNUM_FORMAT_STR "/inode=%" PRIu64, DEVNUM_FORMAT_VAL(st.st_dev), (uint64_t) st.st_ino);
log_unit_debug(UNIT(s), "Trying to stash fd for dev=" DEVNUM_FORMAT_STR "/inode=%" PRIu64,
DEVNUM_FORMAT_VAL(st.st_dev), (uint64_t) st.st_ino);
if (s->n_fd_store >= s->n_fd_store_max)
/* Our store is full. Use this errno rather than E[NM]FILE to distinguish from the case
@@ -557,17 +558,16 @@ static int service_add_fd_store(Service *s, int fd_in, const char *name, bool do
r = sd_event_add_io(UNIT(s)->manager->event, &fs->event_source, fs->fd, 0, on_fd_store_io, fs);
if (r < 0 && r != -EPERM) /* EPERM indicates fds that aren't pollable, which is OK */
return r;
else if (r >= 0)
if (r >= 0)
(void) sd_event_source_set_description(fs->event_source, "service-fd-store");
}
fs->service = s;
LIST_PREPEND(fd_store, s->fd_store, fs);
s->n_fd_store++;
log_unit_debug(UNIT(s), "Added fd %i (%s) to fd store.", fs->fd, fs->fdname);
TAKE_PTR(fs);
fs->service = s;
LIST_PREPEND(fd_store, s->fd_store, TAKE_PTR(fs));
s->n_fd_store++;
return 1; /* fd newly stored */
}