return;
}
- if (ucred && (errno == ESRCH || errno == EPERM)) {
+ if (ucred && IN_SET(errno, ESRCH, EPERM)) {
struct ucred u;
/* Hmm, presumably the sender process vanished
if (LOG_PRI(priority) > s->max_level_syslog)
return;
- IOVEC_SET_STRING(iovec, buffer);
+ iovec = IOVEC_MAKE_STRING(buffer);
forward_syslog_iovec(s, &iovec, 1, ucred, tv);
}
int n = 0;
time_t t;
struct tm *tm;
- char *ident_buf = NULL;
+ _cleanup_free_ char *ident_buf = NULL;
assert(s);
assert(priority >= 0);
/* First: priority field */
xsprintf(header_priority, "<%i>", priority);
- IOVEC_SET_STRING(iovec[n++], header_priority);
+ iovec[n++] = IOVEC_MAKE_STRING(header_priority);
/* Second: timestamp */
t = tv ? tv->tv_sec : ((time_t) (now(CLOCK_REALTIME) / USEC_PER_SEC));
return;
if (strftime(header_time, sizeof(header_time), "%h %e %T ", tm) <= 0)
return;
- IOVEC_SET_STRING(iovec[n++], header_time);
+ iovec[n++] = IOVEC_MAKE_STRING(header_time);
/* Third: identifier and PID */
if (ucred) {
xsprintf(header_pid, "["PID_FMT"]: ", ucred->pid);
if (identifier)
- IOVEC_SET_STRING(iovec[n++], identifier);
+ iovec[n++] = IOVEC_MAKE_STRING(identifier);
- IOVEC_SET_STRING(iovec[n++], header_pid);
+ iovec[n++] = IOVEC_MAKE_STRING(header_pid);
} else if (identifier) {
- IOVEC_SET_STRING(iovec[n++], identifier);
- IOVEC_SET_STRING(iovec[n++], ": ");
+ iovec[n++] = IOVEC_MAKE_STRING(identifier);
+ iovec[n++] = IOVEC_MAKE_STRING(": ");
}
/* Fourth: message */
- IOVEC_SET_STRING(iovec[n++], message);
+ iovec[n++] = IOVEC_MAKE_STRING(message);
forward_syslog_iovec(s, iovec, n, ucred, tv);
-
- free(ident_buf);
}
int syslog_fixup_facility(int priority) {
if (s->forward_to_wall)
server_forward_wall(s, priority, identifier, buf, ucred);
- IOVEC_SET_STRING(iovec[n++], "_TRANSPORT=syslog");
+ iovec[n++] = IOVEC_MAKE_STRING("_TRANSPORT=syslog");
xsprintf(syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK);
- IOVEC_SET_STRING(iovec[n++], syslog_priority);
+ iovec[n++] = IOVEC_MAKE_STRING(syslog_priority);
if (priority & LOG_FACMASK) {
xsprintf(syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority));
- IOVEC_SET_STRING(iovec[n++], syslog_facility);
+ iovec[n++] = IOVEC_MAKE_STRING(syslog_facility);
}
if (identifier) {
syslog_identifier = strjoina("SYSLOG_IDENTIFIER=", identifier);
- IOVEC_SET_STRING(iovec[n++], syslog_identifier);
+ iovec[n++] = IOVEC_MAKE_STRING(syslog_identifier);
}
if (pid) {
syslog_pid = strjoina("SYSLOG_PID=", pid);
- IOVEC_SET_STRING(iovec[n++], syslog_pid);
+ iovec[n++] = IOVEC_MAKE_STRING(syslog_pid);
}
message = strjoina("MESSAGE=", buf);
if (message)
- IOVEC_SET_STRING(iovec[n++], message);
+ iovec[n++] = IOVEC_MAKE_STRING(message);
if (ucred && pid_is_valid(ucred->pid)) {
r = client_context_get(s, ucred->pid, ucred, label, label_len, NULL, &context);