1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

tree-wide: assorted Coccinelle fixes

It's that time of year again.
This commit is contained in:
Frantisek Sumsal 2021-10-08 11:53:23 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent c17e8ce9ec
commit b98416e100
6 changed files with 10 additions and 10 deletions

View File

@ -1412,7 +1412,7 @@ static int verb_log_control(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
assert(argc == 1 || argc == 2);
assert(IN_SET(argc, 1, 2));
r = acquire_bus(&bus, NULL);
if (r < 0)
@ -2284,7 +2284,7 @@ static int do_security(int argc, char *argv[], void *userdata) {
if (r < 0 && r != -ENOENT)
return r;
if (f != NULL) {
if (f) {
r = json_parse_file(f, pp, /*flags=*/ 0, &policy, &line, &column);
if (r < 0)
return log_error_errno(r, "[%s:%u:%u] Failed to parse JSON policy: %m", pp, line, column);

View File

@ -1004,7 +1004,7 @@ static int attach_luks2_by_pkcs11(
bool headless,
uint32_t flags) {
int r = -ENOTSUP;
int r = -EOPNOTSUPP;
#if HAVE_LIBCRYPTSETUP_PLUGINS
if (!crypt_get_type(cd) || strcmp(crypt_get_type(cd), CRYPT_LUKS2))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Automatic PKCS#11 metadata requires LUKS2 device.");
@ -1198,7 +1198,7 @@ static int attach_luks2_by_tpm2(
.device = arg_tpm2_device
};
if (crypt_token_external_path() == NULL)
if (!crypt_token_external_path())
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
"Libcryptsetup has external plugins support disabled.");

View File

@ -2540,7 +2540,7 @@ static int verb_log_level(int argc, char *argv[], void *userdata) {
sd_bus *bus = userdata;
assert(bus);
assert(argc == 1 || argc == 2);
assert(IN_SET(argc, 1, 2));
return verb_log_control_common(bus, "org.freedesktop.resolve1", argv[0], argc == 2 ? argv[1] : NULL);
}

View File

@ -1596,7 +1596,7 @@ int dissect_image(
}
if (m->verity_ready)
m->verity_sig_ready = !!verity->root_hash_sig;
m->verity_sig_ready = verity->root_hash_sig;
} else if (m->partitions[verity->designator == PARTITION_USR ? PARTITION_USR_VERITY_SIG : PARTITION_ROOT_VERITY_SIG].found) {

View File

@ -529,7 +529,7 @@ int fork_agent(const char *name, int except[], size_t n_except, pid_t *ret_pid,
* stdin around. */
fd = open("/dev/tty", O_WRONLY);
if (fd < 0) {
if (errno != -ENXIO) {
if (errno != ENXIO) {
log_error_errno(errno, "Failed to open /dev/tty: %m");
_exit(EXIT_FAILURE);
}

View File

@ -219,9 +219,9 @@ int pkcs11_token_login_by_pin(
return log_error_errno(SYNTHETIC_ERRNO(EIO),
"Failed to log into security token '%s': %s", token_label, p11_kit_strerror(rv));
log_notice("PIN for token '%s' is incorrect, please try again.", token_label);
return -ENOLCK;
return log_notice_errno(SYNTHETIC_ERRNO(ENOLCK),
"PIN for token '%s' is incorrect, please try again.",
token_label);
}
int pkcs11_token_login(