+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd.
#include "user-util.h"
#include "util.h"
+#define SHORT_BUS_CALL_TIMEOUT_USEC (3 * USEC_PER_SEC)
+
static usec_t arg_since = USEC_INFINITY, arg_until = USEC_INFINITY;
static enum {
else
present = "-";
- if (STR_IN_SET(present, "present", "journal") && streq_ptr(truncated, "yes"))
+ if (STR_IN_SET(present, "present", "journal") && truncated && parse_boolean(truncated) > 0)
present = "truncated";
fprintf(file, "%-*s %*s %*s %*s %*s %-*s %s\n",
fprintf(file, " Hostname: %s\n", hostname);
if (filename) {
- bool inacc = access(filename, R_OK) < 0;
- bool trunc = streq_ptr(truncated, "yes");
+ bool inacc, trunc;
+
+ inacc = access(filename, R_OK) < 0;
+ trunc = truncated && parse_boolean(truncated) > 0;
if (inacc || trunc)
fprintf(file, " Storage: %s%s (%s%s%s)%s\n",
}
if (filename) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
_cleanup_close_ int fdf;
fdf = open(filename, O_RDONLY | O_CLOEXEC);
if (r < 0)
return bus_log_create_error(r);
- r = sd_bus_call(bus, m, 3 * USEC_PER_SEC, &error, &reply);
+ r = sd_bus_call(bus, m, SHORT_BUS_CALL_TIMEOUT_USEC, &error, &reply);
if (r < 0)
return log_error_errno(r, "Failed to check if any systemd-coredump@.service units are running: %s",
bus_error_message(&error, r));
reply, "(ssssssouso)",
&id, NULL, NULL, &state, &substate,
NULL, NULL, NULL, NULL, NULL)) > 0) {
- bool found = !STR_IN_SET(state, "dead", "failed");
+ bool found = !STR_IN_SET(state, "inactive", "dead", "failed");
log_debug("Unit %s is %s/%s, %scounting it.", id, state, substate, found ? "" : "not ");
c += found;
}