return -ENOMEM;
}
+ free(*target);
*target = buf;
*target_size = nl;
const void *data;
size_t length;
size_t n = 0;
- char *hostname = NULL, *identifier = NULL, *comm = NULL, *pid = NULL, *message = NULL;
- size_t hostname_len = 0, identifier_len = 0, comm_len = 0, pid_len = 0, message_len = 0;
+ char *hostname = NULL, *identifier = NULL, *comm = NULL, *pid = NULL, *fake_pid = NULL, *message = NULL;
+ size_t hostname_len = 0, identifier_len = 0, comm_len = 0, pid_len = 0, fake_pid_len = 0, message_len = 0;
assert(j);
else if (r > 0)
continue;
+ r = parse_field(data, length, "SYSLOG_PID=", &fake_pid, &fake_pid_len);
+ if (r < 0)
+ goto finish;
+ else if (r > 0)
+ continue;
+
r = parse_field(data, length, "MESSAGE=", &message, &message_len);
if (r < 0)
goto finish;
if (pid && shall_print(show_all, pid, pid_len)) {
printf("[%.*s]", (int) pid_len, pid);
n += pid_len + 2;
+ } else if (fake_pid && shall_print(show_all, fake_pid, fake_pid_len)) {
+ printf("[%.*s]", (int) fake_pid_len, fake_pid);
+ n += fake_pid_len + 2;
}
if (show_all)
free(identifier);
free(comm);
free(pid);
+ free(fake_pid);
free(message);
return r;