Skip to content

Commit c5855d9

Browse files
committed
notify-recv: several follow-ups for notify_socket_prepare()
Follow-ups for 2351bc9. Addresses post-merge review: systemd#36911 (review)
1 parent 79bc762 commit c5855d9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/shared/notify-recv.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ int notify_socket_prepare(
1717
int r;
1818

1919
assert(event);
20+
assert(ret_path);
21+
22+
/* This creates an autobind AF_UNIX socket and adds an IO event source for the socket, which helps
23+
* prepare the notification socket used to communicate with worker processes. */
2024

2125
_cleanup_close_ int fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
2226
if (fd < 0)
@@ -34,7 +38,7 @@ int notify_socket_prepare(
3438
/* SO_PASSPIDFD is supported since kernel v6.5. */
3539
r = setsockopt_int(fd, SOL_SOCKET, SO_PASSPIDFD, true);
3640
if (r < 0)
37-
log_debug_errno(r, "Failed to enable SO_PASSPIDFD on notification socket, ignoring. %m");
41+
log_debug_errno(r, "Failed to enable SO_PASSPIDFD on notification socket, ignoring: %m");
3842

3943
_cleanup_(sd_event_source_unrefp) sd_event_source *s = NULL;
4044
r = sd_event_add_io(event, &s, fd, EPOLLIN, handler, userdata);
@@ -56,9 +60,7 @@ int notify_socket_prepare(
5660
if (r < 0)
5761
return log_debug_errno(r, "Failed to make notification event source floating: %m");
5862

59-
if (ret_path)
60-
*ret_path = TAKE_PTR(path);
61-
63+
*ret_path = TAKE_PTR(path);
6264
return 0;
6365
}
6466

0 commit comments

Comments
 (0)