1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-12 08:58:20 +03:00

tree-wide: a bunch of Coccinelle-suggested tweaks

rc2 edition
This commit is contained in:
Frantisek Sumsal 2023-07-14 17:39:05 +02:00 committed by Luca Boccassi
parent a4333be63a
commit be492020ec
4 changed files with 4 additions and 5 deletions

View File

@ -18,7 +18,7 @@ static int get_pcr_alg(const char **ret) {
return log_oom();
if (access(p, F_OK) < 0) {
if (errno != -ENOENT)
if (errno != ENOENT)
return log_error_errno(errno, "Failed to determine whether %s exists: %m", p);
} else {
*ret = alg;

View File

@ -535,8 +535,7 @@ char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigne
for (const char *p = s + len; p < j; ) {
size_t slen = ansi_sequence_length(p, j - p);
if (slen > 0) {
memcpy(dst, p, slen);
dst += slen;
dst = mempcpy(dst, p, slen);
p += slen;
} else
p = utf8_next_char(p);

View File

@ -70,7 +70,7 @@ bool credential_glob_valid(const char *s) {
return false;
/* Make a copy of the string without the '*' suffix */
a = strndupa(s, n);
a = strndupa_safe(s, n);
return credential_name_valid(a);
}

View File

@ -458,7 +458,7 @@ static int run(int argc, char **argv) {
if (!exec_argv)
return log_oom();
assert(strv_length(exec_argv) > 0);
assert(!strv_isempty(exec_argv));
r = install_chld_handler();
if (r < 0)