1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-11 20:58:27 +03:00

Merge pull request #31932 from bluca/coverity

Fix coverity issues
This commit is contained in:
Yu Watanabe 2024-03-26 03:04:51 +09:00 committed by GitHub
commit 373452ff9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -56,6 +56,7 @@ int user_record_authenticate(
assert(h);
assert(secret);
assert(cache);
/* Tries to authenticate a user record with the supplied secrets. i.e. checks whether at least one
* supplied plaintext passwords matches a hashed password field of the user record. Or if a
@ -78,7 +79,7 @@ int user_record_authenticate(
* to force re-authentication. */
/* First, let's see if we already have a volume key from the keyring */
if (cache && cache->volume_key &&
if (cache->volume_key &&
json_variant_is_blank_object(json_variant_by_key(secret->json, "secret"))) {
log_info("LUKS volume key from keyring unlocks user record.");
return 1;

View File

@ -23,10 +23,8 @@ TEST (test_dirent_ensure_type) {
.d_name = "test",
};
assert_se(de.d_type == DT_UNKNOWN);
dir_fd = 0;
dirent_ensure_type(dir_fd, &de);
assert_se(dirent_ensure_type(dir_fd, &de) == -ENOTDIR);
/* Test when d_name is "." or ".." */
strcpy(de.d_name, ".");