- snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) ucred->pid);
+ snprintf(header_pid, sizeof(header_pid), "["PID_FMT"]: ", ucred->pid);
/* Did we lose any? */
if (serial > *s->kernel_seqnum)
server_driver_message(s, SD_MESSAGE_JOURNAL_MISSED, "Missed %"PRIu64" kernel messages",
/* Did we lose any? */
if (serial > *s->kernel_seqnum)
server_driver_message(s, SD_MESSAGE_JOURNAL_MISSED, "Missed %"PRIu64" kernel messages",
/* Make sure we never read this one again. Note that
* we always store the next message serial we expect
/* Make sure we never read this one again. Note that
* we always store the next message serial we expect
if (asprintf(&syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK) >= 0)
IOVEC_SET_STRING(iovec[n++], syslog_priority);
if (asprintf(&syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK) >= 0)
IOVEC_SET_STRING(iovec[n++], syslog_priority);
if ((priority & LOG_FACMASK) == LOG_KERN)
IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
else {
if ((priority & LOG_FACMASK) == LOG_KERN)
IOVEC_SET_STRING(iovec[n++], "SYSLOG_IDENTIFIER=kernel");
else {
- if (s->dev_kmsg_event_source)
- s->dev_kmsg_event_source = sd_event_source_unref(s->dev_kmsg_event_source);
-
- if (s->dev_kmsg_fd >= 0) {
- close_nointr_nofail(s->dev_kmsg_fd);
- s->dev_kmsg_fd = -1;
- }
+ s->dev_kmsg_event_source = sd_event_source_unref(s->dev_kmsg_event_source);
+ s->dev_kmsg_fd = safe_close(s->dev_kmsg_fd);
if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) {
log_error("Failed to allocate sequential number file, ignoring: %m");
if (posix_fallocate(fd, 0, sizeof(uint64_t)) < 0) {
log_error("Failed to allocate sequential number file, ignoring: %m");
return 0;
}
p = mmap(NULL, sizeof(uint64_t), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (p == MAP_FAILED) {
log_error("Failed to map sequential number file, ignoring: %m");
return 0;
}
p = mmap(NULL, sizeof(uint64_t), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (p == MAP_FAILED) {
log_error("Failed to map sequential number file, ignoring: %m");