On Sat, 19.09.15 18:54, Benjamin Robin ([email protected]) wrote:
> The tool called this way: "systemd-notify --pid=$$" is not working
>
> When calling sd_pid_notify* functions with a valid pid (pid != 0),
> the sendmsg failed.
> The msg_controllen is invalid, because CMSG_SPACE(0) is not equal to
> 0.
This already has been fixed in git a few days ago:
a5bd3c32abb00ad945282568fd1a97c180b68047
> if (n_fds > 0 || have_pid) {
> - msghdr.msg_controllen = CMSG_SPACE(sizeof(int) * n_fds) +
> - CMSG_SPACE(sizeof(struct ucred) *
> have_pid);
> + if (n_fds > 0) {
> + msghdr.msg_controllen += CMSG_SPACE(sizeof(int) *
> n_fds);
> + }
> + if (have_pid) {
> + msghdr.msg_controllen += CMSG_SPACE(sizeof(struct
> ucred));
> + }
Just for the sake of review: one-line if blocks without the brackets please,
see CODING_STYLE.
Thanks,
Lennart
--
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel