journald: fix forwarding to syslog
.msg_namelen was set to a bogus value before we actually stored the path in the the structure. sockaddr_un_set_path() returns the length, so just use that. Fixes #14799.
This commit is contained in:
parent
8ad2012d1e
commit
64177e9e4e
|
@ -32,14 +32,11 @@ static void forward_syslog_iovec(
|
||||||
const struct ucred *ucred,
|
const struct ucred *ucred,
|
||||||
const struct timeval *tv) {
|
const struct timeval *tv) {
|
||||||
|
|
||||||
union sockaddr_union sa = {
|
union sockaddr_union sa;
|
||||||
.un.sun_family = AF_UNIX,
|
|
||||||
};
|
|
||||||
struct msghdr msghdr = {
|
struct msghdr msghdr = {
|
||||||
.msg_iov = (struct iovec *) iovec,
|
.msg_iov = (struct iovec *) iovec,
|
||||||
.msg_iovlen = n_iovec,
|
.msg_iovlen = n_iovec,
|
||||||
.msg_name = (struct sockaddr*) &sa.sa,
|
|
||||||
.msg_namelen = SOCKADDR_UN_LEN(sa.un),
|
|
||||||
};
|
};
|
||||||
struct cmsghdr *cmsg;
|
struct cmsghdr *cmsg;
|
||||||
union {
|
union {
|
||||||
|
@ -60,6 +57,9 @@ static void forward_syslog_iovec(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msghdr.msg_name = &sa.sa;
|
||||||
|
msghdr.msg_namelen = r;
|
||||||
|
|
||||||
if (ucred) {
|
if (ucred) {
|
||||||
zero(control);
|
zero(control);
|
||||||
msghdr.msg_control = &control;
|
msghdr.msg_control = &control;
|
||||||
|
|
Loading…
Reference in a new issue