notify-recv: add notify_recv() flavour that returns a split up strv instead of he message text as string

This is useful at various places, since we split up the message as first
thing there anyway.
This commit is contained in:
Lennart Poettering
2025-02-28 14:17:52 +01:00
parent 649c63d6ac
commit 19ade24464
4 changed files with 59 additions and 14 deletions
+2 -8
View File
@@ -2798,7 +2798,6 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
Manager *m = ASSERT_PTR(userdata);
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
struct ucred ucred;
_cleanup_free_ char *buf = NULL;
_cleanup_(fdset_free_asyncp) FDSet *fds = NULL;
int r;
@@ -2809,7 +2808,8 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
return 0;
}
r = notify_recv_with_fds(m->notify_fd, &buf, &ucred, &pidref, &fds);
_cleanup_strv_free_ char **tags = NULL;
r = notify_recv_with_fds_strv(m->notify_fd, &tags, &ucred, &pidref, &fds);
if (r == -EAGAIN)
return 0;
if (r < 0)
@@ -2819,12 +2819,6 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
* socket. */
return r;
_cleanup_strv_free_ char **tags = strv_split_newlines(buf);
if (!tags) {
log_oom_warning();
return 0;
}
/* Possibly a barrier fd, let's see. */
if (manager_process_barrier_fd(tags, fds)) {
log_debug("Received barrier notification message from PID " PID_FMT ".", pidref.pid);