1
0
mirror of https://github.com/systemd/systemd synced 2025-09-23 22:04:45 +02:00

Compare commits

..

No commits in common. "2b8c2fbb2ddc7a699901c52d1941da469ec194d1" and "e65848175fe7ce79c724625aad2381886026bc1d" have entirely different histories.

23 changed files with 114 additions and 178 deletions

View File

@ -347,16 +347,15 @@
<varlistentry>
<term><varname>_LINE_BREAK=</varname></term>
<listitem>
<para>Only applies to <literal>_TRANSPORT=stdout</literal> records: indicates that the log message
in the standard output/error stream was not terminated with a normal newline character
(<literal>\n</literal>, i.e. ASCII 10). Specifically, when set this field is one of
<option>nul</option> (in case the line was terminated by a NUL byte), <option>line-max</option> (in
case the maximum log line length was reached, as configured with <varname>LineMax=</varname> in
<citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>),
<option>eof</option> (if this was the last log record of a stream and the stream ended without a
final newline character), or <option>pid-change</option> (if the process which generated the log
output changed in the middle of a line). Note that this record is not generated when a normal
newline character was used for marking the log line end.</para>
<para>Only applies to <literal>_TRANSPORT=stdout</literal> records: indicates that the log message in the
standard output/error stream was not terminated with a normal newline character (<literal>\n</literal>,
i.e. ASCII 10). Specifically, when set this field is one of <option>nul</option> (in case the line was
terminated by a NUL byte), <option>line-max</option> (in case the maximum log line length was reached, as
configured with <varname>LineMax=</varname> in
<citerefentry><refentrytitle>journald.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>) or
<option>eof</option> (if this was the last log record of a stream and the stream ended without a final
newline character). Note that this record is not generated when a normal newline character was used for
marking the log line end.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -36,7 +36,7 @@ apt-get -q --allow-releaseinfo-change update
apt-get -y dist-upgrade
apt-get install -y eatmydata
# The following four are needed as long as these deps are not covered by Debian's own packaging
apt-get install -y fdisk libfdisk-dev libp11-kit-dev libssl-dev libpwquality-dev
apt-get install -y libfdisk-dev libp11-kit-dev libssl-dev libpwquality-dev
apt-get purge --auto-remove -y unattended-upgrades
systemctl unmask systemd-networkd
systemctl enable systemd-networkd

View File

@ -106,7 +106,7 @@ bool strv_overlap(char * const *a, char * const *b) _pure_;
#define STRV_FOREACH_BACKWARDS(s, l) \
for (s = ({ \
typeof(l) _l = l; \
char **_l = l; \
_l ? _l + strv_length(_l) - 1U : NULL; \
}); \
(l) && ((s) >= (l)); \

View File

@ -2288,19 +2288,16 @@ static int manager_dispatch_cgroups_agent_fd(sd_event_source *source, int fd, ui
return 0;
}
static bool manager_process_barrier_fd(char * const *tags, FDSet *fds) {
static bool manager_process_barrier_fd(const char *buf, FDSet *fds) {
assert(buf);
/* nothing else must be sent when using BARRIER=1 */
if (strv_contains(tags, "BARRIER=1")) {
if (strv_length(tags) == 1) {
if (fdset_size(fds) != 1)
log_warning("Got incorrect number of fds with BARRIER=1, closing them.");
} else
log_warning("Extra notification messages sent with BARRIER=1, ignoring everything.");
/* Drop the message if BARRIER=1 was found */
if (STR_IN_SET(buf, "BARRIER=1", "BARRIER=1\n")) {
if (fdset_size(fds) != 1)
log_warning("Got incorrect number of fds with BARRIER=1, closing them.");
return true;
}
} else if (startswith(buf, "BARRIER=1\n") || strstr(buf, "\nBARRIER=1\n") || endswith(buf, "\nBARRIER=1"))
log_warning("Extra notification messages sent with BARRIER=1, ignoring everything.");
return false;
}
@ -2309,27 +2306,33 @@ static void manager_invoke_notify_message(
Manager *m,
Unit *u,
const struct ucred *ucred,
char * const *tags,
const char *buf,
FDSet *fds) {
assert(m);
assert(u);
assert(ucred);
assert(tags);
assert(buf);
if (u->notifygen == m->notifygen) /* Already invoked on this same unit in this same iteration? */
return;
u->notifygen = m->notifygen;
if (UNIT_VTABLE(u)->notify_message)
if (UNIT_VTABLE(u)->notify_message) {
_cleanup_strv_free_ char **tags = NULL;
tags = strv_split(buf, NEWLINE);
if (!tags) {
log_oom();
return;
}
UNIT_VTABLE(u)->notify_message(u, ucred, tags, fds);
else if (DEBUG_LOGGING) {
_cleanup_free_ char *buf = NULL, *x = NULL, *y = NULL;
} else if (DEBUG_LOGGING) {
_cleanup_free_ char *x = NULL, *y = NULL;
buf = strv_join(tags, ", ");
if (buf)
x = ellipsize(buf, 20, 90);
x = ellipsize(buf, 20, 90);
if (x)
y = cescape(x);
@ -2358,7 +2361,6 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
struct cmsghdr *cmsg;
struct ucred *ucred = NULL;
_cleanup_free_ Unit **array_copy = NULL;
_cleanup_strv_free_ char **tags = NULL;
Unit *u1, *u2, **array;
int r, *fd_array = NULL;
size_t n_fds = 0;
@ -2427,16 +2429,11 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
return 0;
}
/* Make sure it's NUL-terminated, then parse it to obtain the tags list */
/* Make sure it's NUL-terminated. */
buf[n] = 0;
tags = strv_split_newlines(buf);
if (!tags) {
log_oom();
return 0;
}
/* possibly a barrier fd, let's see */
if (manager_process_barrier_fd(tags, fds))
if (manager_process_barrier_fd(buf, fds))
return 0;
/* Increase the generation counter used for filtering out duplicate unit invocations. */
@ -2459,16 +2456,16 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
/* And now invoke the per-unit callbacks. Note that manager_invoke_notify_message() will handle duplicate units
* make sure we only invoke each unit's handler once. */
if (u1) {
manager_invoke_notify_message(m, u1, ucred, tags, fds);
manager_invoke_notify_message(m, u1, ucred, buf, fds);
found = true;
}
if (u2) {
manager_invoke_notify_message(m, u2, ucred, tags, fds);
manager_invoke_notify_message(m, u2, ucred, buf, fds);
found = true;
}
if (array_copy)
for (size_t i = 0; array_copy[i]; i++) {
manager_invoke_notify_message(m, array_copy[i], ucred, tags, fds);
manager_invoke_notify_message(m, array_copy[i], ucred, buf, fds);
found = true;
}

View File

@ -227,7 +227,7 @@ int mac_selinux_generic_access_check(
if (getfilecon_raw(path, &fcon) < 0) {
r = -errno;
log_warning_errno(r, "SELinux getfilecon_raw() on '%s' failed%s (perm=%s): %m",
log_warning_errno(r, "SELinux getfilecon_raw on '%s' failed%s (perm=%s): %m",
path,
enforce ? "" : ", ignoring",
permission);
@ -243,7 +243,7 @@ int mac_selinux_generic_access_check(
if (getcon_raw(&fcon) < 0) {
r = -errno;
log_warning_errno(r, "SELinux getcon_raw() failed%s (perm=%s): %m",
log_warning_errno(r, "SELinux getcon_raw failed%s (perm=%s): %m",
enforce ? "" : ", ignoring",
permission);
if (!enforce)

View File

@ -3847,7 +3847,7 @@ static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void
return 0;
}
static bool service_notify_message_authorized(Service *s, pid_t pid, FDSet *fds) {
static bool service_notify_message_authorized(Service *s, pid_t pid, char **tags, FDSet *fds) {
assert(s);
if (s->notify_access == NOTIFY_NONE) {
@ -3894,19 +3894,19 @@ static void service_force_watchdog(Service *s) {
static void service_notify_message(
Unit *u,
const struct ucred *ucred,
char * const *tags,
char **tags,
FDSet *fds) {
Service *s = SERVICE(u);
bool notify_dbus = false;
const char *e;
char * const *i;
char **i;
int r;
assert(u);
assert(ucred);
if (!service_notify_message_authorized(SERVICE(u), ucred->pid, fds))
if (!service_notify_message_authorized(SERVICE(u), ucred->pid, tags, fds))
return;
if (DEBUG_LOGGING) {

View File

@ -539,7 +539,7 @@ typedef struct UnitVTable {
void (*notify_cgroup_oom)(Unit *u);
/* Called whenever a process of this unit sends us a message */
void (*notify_message)(Unit *u, const struct ucred *ucred, char * const *tags, FDSet *fds);
void (*notify_message)(Unit *u, const struct ucred *ucred, char **tags, FDSet *fds);
/* Called whenever a name this Unit registered for comes or goes away. */
void (*bus_name_owner_change)(Unit *u, const char *new_owner);

View File

@ -58,9 +58,6 @@ typedef enum LineBreak {
LINE_BREAK_NUL,
LINE_BREAK_LINE_MAX,
LINE_BREAK_EOF,
LINE_BREAK_PID_CHANGE,
_LINE_BREAK_MAX,
_LINE_BREAK_INVALID = -1,
} LineBreak;
struct StdoutStream {
@ -241,11 +238,7 @@ fail:
return log_error_errno(r, "Failed to save stream data %s: %m", s->state_file);
}
static int stdout_stream_log(
StdoutStream *s,
const char *p,
LineBreak line_break) {
static int stdout_stream_log(StdoutStream *s, const char *p, LineBreak line_break) {
struct iovec *iovec;
int priority;
char syslog_priority[] = "PRIORITY=\0";
@ -257,9 +250,6 @@ static int stdout_stream_log(
assert(s);
assert(p);
assert(line_break >= 0);
assert(line_break < _LINE_BREAK_MAX);
if (s->context)
(void) client_context_maybe_refresh(s->server, s->context, NULL, NULL, 0, NULL, USEC_INFINITY);
else if (pid_is_valid(s->ucred.pid)) {
@ -311,20 +301,17 @@ static int stdout_stream_log(
iovec[n++] = IOVEC_MAKE_STRING(syslog_identifier);
}
static const char * const line_break_field_table[_LINE_BREAK_MAX] = {
[LINE_BREAK_NEWLINE] = NULL, /* Do not add field if traditional newline */
[LINE_BREAK_NUL] = "_LINE_BREAK=nul",
[LINE_BREAK_LINE_MAX] = "_LINE_BREAK=line-max",
[LINE_BREAK_EOF] = "_LINE_BREAK=eof",
[LINE_BREAK_PID_CHANGE] = "_LINE_BREAK=pid-change",
};
if (line_break != LINE_BREAK_NEWLINE) {
const char *c;
const char *c = line_break_field_table[line_break];
/* If this log message was generated due to an uncommon line break then mention this in the log
* entry */
/* If this log message was generated due to an uncommon line break then mention this in the log
* entry */
if (c)
c = line_break == LINE_BREAK_NUL ? "_LINE_BREAK=nul" :
line_break == LINE_BREAK_LINE_MAX ? "_LINE_BREAK=line-max" :
"_LINE_BREAK=eof";
iovec[n++] = IOVEC_MAKE_STRING(c);
}
message = strjoin("MESSAGE=", p);
if (message)
@ -335,8 +322,8 @@ static int stdout_stream_log(
}
static int stdout_stream_line(StdoutStream *s, char *p, LineBreak line_break) {
char *orig;
int r;
char *orig;
assert(s);
assert(p);
@ -345,9 +332,10 @@ static int stdout_stream_line(StdoutStream *s, char *p, LineBreak line_break) {
p = strstrip(p);
/* line breaks by NUL, line max length or EOF are not permissible during the negotiation part of the protocol */
if (line_break != LINE_BREAK_NEWLINE && s->state != STDOUT_STREAM_RUNNING)
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
"Control protocol line not properly terminated.");
if (line_break != LINE_BREAK_NEWLINE && s->state != STDOUT_STREAM_RUNNING) {
log_warning("Control protocol line not properly terminated.");
return -EINVAL;
}
switch (s->state) {
@ -437,43 +425,21 @@ static int stdout_stream_line(StdoutStream *s, char *p, LineBreak line_break) {
assert_not_reached("Unknown stream state");
}
static int stdout_stream_found(
StdoutStream *s,
char *p,
size_t l,
LineBreak line_break) {
char saved;
static int stdout_stream_scan(StdoutStream *s, bool force_flush) {
char *p;
size_t remaining;
int r;
assert(s);
assert(p);
/* Let's NUL terminate the specified buffer for this call, and revert back afterwards */
saved = p[l];
p[l] = 0;
r = stdout_stream_line(s, p, line_break);
p[l] = saved;
p = s->buffer;
remaining = s->length;
return r;
}
static int stdout_stream_scan(
StdoutStream *s,
char *p,
size_t remaining,
LineBreak force_flush,
size_t *ret_consumed) {
size_t consumed = 0;
int r;
assert(s);
assert(p);
/* XXX: This function does nothing if (s->length == 0) */
for (;;) {
LineBreak line_break;
size_t skip, found;
size_t skip;
char *end1, *end2;
end1 = memchr(p, '\n', remaining);
@ -481,40 +447,43 @@ static int stdout_stream_scan(
if (end2) {
/* We found a NUL terminator */
found = end2 - p;
skip = found + 1;
skip = end2 - p + 1;
line_break = LINE_BREAK_NUL;
} else if (end1) {
/* We found a \n terminator */
found = end1 - p;
skip = found + 1;
*end1 = 0;
skip = end1 - p + 1;
line_break = LINE_BREAK_NEWLINE;
} else if (remaining >= s->server->line_max) {
/* Force a line break after the maximum line length */
found = skip = s->server->line_max;
*(p + s->server->line_max) = 0;
skip = remaining;
line_break = LINE_BREAK_LINE_MAX;
} else
break;
r = stdout_stream_found(s, p, found, line_break);
r = stdout_stream_line(s, p, line_break);
if (r < 0)
return r;
p += skip;
consumed += skip;
remaining -= skip;
p += skip;
}
if (force_flush >= 0 && remaining > 0) {
r = stdout_stream_found(s, p, remaining, force_flush);
if (force_flush && remaining > 0) {
p[remaining] = 0;
r = stdout_stream_line(s, p, LINE_BREAK_EOF);
if (r < 0)
return r;
consumed += remaining;
p += remaining;
remaining = 0;
}
if (ret_consumed)
*ret_consumed = consumed;
if (p > s->buffer) {
memmove(s->buffer, p, remaining);
s->length = remaining;
}
return 0;
}
@ -522,11 +491,10 @@ static int stdout_stream_scan(
static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents, void *userdata) {
CMSG_BUFFER_TYPE(CMSG_SPACE(sizeof(struct ucred))) control;
StdoutStream *s = userdata;
size_t limit, consumed;
struct ucred *ucred;
struct iovec iovec;
size_t limit;
ssize_t l;
char *p;
int r;
struct msghdr msghdr = {
@ -543,8 +511,8 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
goto terminate;
}
/* If the buffer is almost full, add room for another 1K */
if (s->length + 512 >= s->allocated) {
/* If the buffer is full already (discounting the extra NUL we need), add room for another 1K */
if (s->length + 1 >= s->allocated) {
if (!GREEDY_REALLOC(s->buffer, s->allocated, s->length + 1 + 1024)) {
log_oom();
goto terminate;
@ -554,7 +522,7 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
/* Try to make use of the allocated buffer in full, but never read more than the configured line size. Also,
* always leave room for a terminating NUL we might need to add. */
limit = MIN(s->allocated - 1, s->server->line_max);
assert(s->length <= limit);
iovec = IOVEC_MAKE(s->buffer + s->length, limit - s->length);
l = recvmsg(s->fd, &msghdr, MSG_DONTWAIT|MSG_CMSG_CLOEXEC);
@ -568,42 +536,32 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
cmsg_close_all(&msghdr);
if (l == 0) {
(void) stdout_stream_scan(s, s->buffer, s->length, /* force_flush = */ LINE_BREAK_EOF, NULL);
stdout_stream_scan(s, true);
goto terminate;
}
/* Invalidate the context if the PID of the sender changed. This happens when a forked process
* inherits stdout/stderr from a parent. In this case getpeercred() returns the ucred of the parent,
* which can be invalid if the parent has exited in the meantime. */
/* Invalidate the context if the pid of the sender changed. This happens when a forked process
* inherits stdout / stderr from a parent. In this case getpeercred returns the ucred of the parent,
* which can be invalid if the parent has exited in the meantime.
*/
ucred = CMSG_FIND_DATA(&msghdr, SOL_SOCKET, SCM_CREDENTIALS, struct ucred);
if (ucred && ucred->pid != s->ucred.pid) {
/* Force out any previously half-written lines from a different process, before we switch to
/* force out any previously half-written lines from a different process, before we switch to
* the new ucred structure for everything we just added */
r = stdout_stream_scan(s, s->buffer, s->length, /* force_flush = */ LINE_BREAK_PID_CHANGE, NULL);
r = stdout_stream_scan(s, true);
if (r < 0)
goto terminate;
s->context = client_context_release(s->server, s->context);
p = s->buffer + s->length;
} else {
p = s->buffer;
l += s->length;
s->ucred = *ucred;
client_context_release(s->server, s->context);
s->context = NULL;
}
/* Always copy in the new credentials */
if (ucred)
s->ucred = *ucred;
r = stdout_stream_scan(s, p, l, _LINE_BREAK_INVALID, &consumed);
s->length += l;
r = stdout_stream_scan(s, false);
if (r < 0)
goto terminate;
/* Move what wasn't consumed to the front of the buffer */
assert(consumed <= (size_t) l);
s->length = l - consumed;
memmove(s->buffer, p + consumed, s->length);
return 1;
terminate:

View File

@ -22,5 +22,4 @@ static void test_audit_type(void) {
int main(int argc, char **argv) {
test_audit_type();
return 0;
}

View File

@ -590,7 +590,8 @@ _public_ int sd_radv_add_prefix(sd_radv *ra, sd_radv_prefix *p, int dynamic) {
cur->valid_until = valid_until;
cur->preferred_until = preferred_until;
log_radv("Updated prefix %s/%u preferred %s valid %s",
log_radv("%s prefix %s/%u preferred %s valid %s",
cur? "Updated": "Added",
addr_p, p->opt.prefixlen,
format_timespan(time_string_preferred, FORMAT_TIMESPAN_MAX,
preferred, USEC_PER_SEC),
@ -690,7 +691,8 @@ _public_ int sd_radv_add_route_prefix(sd_radv *ra, sd_radv_route_prefix *p, int
if (valid_until == USEC_INFINITY)
return -EOVERFLOW;
log_radv("Updated route prefix %s/%u valid %s",
log_radv("%s route prefix %s/%u valid %s",
cur? "Updated": "Added",
strempty(pretty), p->opt.prefixlen,
format_timespan(time_string_valid, FORMAT_TIMESPAN_MAX, valid, USEC_PER_SEC));

View File

@ -87,5 +87,4 @@ int main(int argc, char *argv[]) {
test_dhcp_lease_parse_search_domains_no_data();
test_dhcp_lease_parse_search_domains_loops();
test_dhcp_lease_parse_search_domains_wrong_len();
return 0;
}

View File

@ -317,7 +317,7 @@ static void* client1(void *p) {
finish:
if (bus) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *q = NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *q;
r = sd_bus_message_new_method_call(
bus,
@ -485,7 +485,7 @@ static void* client2(void *p) {
finish:
if (bus) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *q = NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *q;
r = sd_bus_message_new_method_call(
bus,

View File

@ -15,7 +15,8 @@
#include "socket-util.h"
#include "strv.h"
#define GET_CONTAINER(m, i) ((struct rtattr*)((uint8_t*)(m)->hdr + (m)->containers[i].offset))
#define GET_CONTAINER(m, i) ((i) < (m)->n_containers ? (struct rtattr*)((uint8_t*)(m)->hdr + (m)->containers[i].offset) : NULL)
#define PUSH_CONTAINER(m, new) (m)->container_offsets[(m)->n_containers++] = (uint8_t*)(new) - (uint8_t*)(m)->hdr;
#define RTA_TYPE(rta) ((rta)->rta_type & NLA_TYPE_MASK)
#define RTA_FLAGS(rta) ((rta)->rta_type & ~NLA_TYPE_MASK)
@ -519,8 +520,7 @@ int sd_netlink_message_open_container(sd_netlink_message *m, unsigned short type
assert_return(m, -EINVAL);
assert_return(!m->sealed, -EPERM);
/* m->containers[m->n_containers + 1] is accessed both in read and write. Prevent access out of bound */
assert_return(m->n_containers < (RTNL_CONTAINER_DEPTH - 1), -ERANGE);
assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -ERANGE);
r = message_attribute_has_type(m, &size, type, NETLINK_TYPE_NESTED);
if (r < 0) {
@ -567,7 +567,6 @@ int sd_netlink_message_open_container_union(sd_netlink_message *m, unsigned shor
assert_return(m, -EINVAL);
assert_return(!m->sealed, -EPERM);
assert_return(m->n_containers < (RTNL_CONTAINER_DEPTH - 1), -ERANGE);
r = type_system_get_type_system_union(m->containers[m->n_containers].type_system, &type_system_union, type);
if (r < 0)
@ -610,7 +609,6 @@ int sd_netlink_message_open_array(sd_netlink_message *m, uint16_t type) {
assert_return(m, -EINVAL);
assert_return(!m->sealed, -EPERM);
assert_return(m->n_containers < (RTNL_CONTAINER_DEPTH - 1), -ERANGE);
r = add_rtattr(m, type | NLA_F_NESTED, NULL, 0);
if (r < 0)
@ -1009,7 +1007,7 @@ int sd_netlink_message_enter_container(sd_netlink_message *m, unsigned short typ
int r;
assert_return(m, -EINVAL);
assert_return(m->n_containers < (RTNL_CONTAINER_DEPTH - 1), -EINVAL);
assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -EINVAL);
r = type_system_get_type(m->containers[m->n_containers].type_system,
&nl_type,
@ -1100,7 +1098,7 @@ int sd_netlink_message_enter_array(sd_netlink_message *m, unsigned short type_id
int r;
assert_return(m, -EINVAL);
assert_return(m->n_containers < (RTNL_CONTAINER_DEPTH - 1), -EINVAL);
assert_return(m->n_containers < RTNL_CONTAINER_DEPTH, -EINVAL);
r = netlink_message_read_internal(m, type_id, &container, NULL);
if (r < 0)

View File

@ -128,7 +128,7 @@ static void test_address_get(sd_netlink *rtnl, int ifindex) {
}
static void test_route(sd_netlink *rtnl) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req;
struct in_addr addr, addr_data;
uint32_t index = 2, u32_data;
int r;

View File

@ -828,7 +828,7 @@ int config_parse_macsec_key_id(
_cleanup_(macsec_transmit_association_free_or_set_invalidp) TransmitAssociation *a = NULL;
_cleanup_(macsec_receive_association_free_or_set_invalidp) ReceiveAssociation *b = NULL;
_cleanup_free_ void *p = NULL;
_cleanup_free_ void *p;
MACsec *s = userdata;
uint8_t *dest;
size_t l;

View File

@ -253,5 +253,4 @@ int main(void) {
test_network_get(manager, loopback);
assert_se(manager_rtnl_enumerate_links(manager) >= 0);
return 0;
}

View File

@ -28,7 +28,7 @@ static ssize_t dnstls_stream_writev(gnutls_transport_ptr_t p, const giovec_t *io
}
int dnstls_stream_connect_tls(DnsStream *stream, DnsServer *server) {
_cleanup_(gnutls_deinitp) gnutls_session_t gs = NULL;
_cleanup_(gnutls_deinitp) gnutls_session_t gs;
int r;
assert(stream);

View File

@ -1743,7 +1743,7 @@ int seccomp_restrict_archs(Set *archs) {
}
int parse_syscall_archs(char **l, Set **archs) {
_cleanup_set_free_ Set *_archs = NULL;
_cleanup_set_free_ Set *_archs;
char **s;
int r;

View File

@ -3775,8 +3775,6 @@ static int clean_or_freeze_unit(int argc, char *argv[], void *userdata) {
method = "FreezeUnit";
else if (streq(argv[0], "thaw"))
method = "ThawUnit";
else
assert_not_reached("Unhandled method");
STRV_FOREACH(name, names) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;

View File

@ -21,7 +21,7 @@ static void do_fstab_filter_options(const char *opts,
int r;
const char *name;
_cleanup_free_ char *value = NULL, *filtered = NULL;
_cleanup_free_ char *value, *filtered;
r = fstab_filter_options(opts, remove, &name, &value, &filtered);
log_info("\"%s\" → %d, \"%s\", \"%s\", \"%s\", expected %d, \"%s\", \"%s\", \"%s\"",

View File

@ -207,7 +207,7 @@ static int link_unsigned_attribute(sd_device *device, const char *attr, unsigned
}
int link_config_load(link_config_ctx *ctx) {
_cleanup_strv_free_ char **files = NULL;
_cleanup_strv_free_ char **files;
char **f;
int r;

View File

@ -87,18 +87,6 @@ journalctl -b -o export -t "$ID" --output-fields=_PID | grep '^_PID=' >/output
grep -q "^_PID=$PID" /output
grep -vq "^_PID=$PID" /output
# https://github.com/systemd/systemd/issues/15654
ID=$(journalctl --new-id128 | sed -n 2p)
printf "This will\nusually fail\nand be truncated\n">/expected
systemd-cat -t "$ID" /bin/sh -c 'env echo -n "This will";echo;env echo -n "usually fail";echo;env echo -n "and be truncated";echo;'
journalctl --sync
journalctl -b -o cat -t "$ID" >/output
cmp /expected /output
[[ $(journalctl -b -o cat -t "$ID" --output-fields=_TRANSPORT | grep -Pc "^stdout$") -eq 3 ]]
[[ $(journalctl -b -o cat -t "$ID" --output-fields=_LINE_BREAK | grep -Pc "^pid-change$") -eq 3 ]]
[[ $(journalctl -b -o cat -t "$ID" --output-fields=_PID | sort -u | grep -c "^.*$") -eq 3 ]]
[[ $(journalctl -b -o cat -t "$ID" --output-fields=MESSAGE | grep -Pc "^(This will|usually fail|and be truncated)$") -eq 3 ]]
# Add new tests before here, the journald restarts below
# may make tests flappy.

View File

@ -20,7 +20,6 @@ ADDITIONAL_DEPS=(python3-libevdev
clang
perl
libpwquality-dev
fdisk
libfdisk-dev
libp11-kit-dev
libssl-dev