1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

ask-password: don't hit assert() when we query pw which the user C-d and caching is enabled

This commit is contained in:
Lennart Poettering 2019-11-13 20:07:31 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 07d5ed536e
commit e013e10d0e

View File

@ -105,10 +105,11 @@ static int add_to_keyring(const char *keyname, AskPasswordFlags flags, char **pa
int r;
assert(keyname);
assert(passwords);
if (!(flags & ASK_PASSWORD_PUSH_CACHE))
return 0;
if (strv_isempty(passwords))
return 0;
r = lookup_key(keyname, &serial);
if (r >= 0) {
@ -147,7 +148,6 @@ static int add_to_keyring_and_log(const char *keyname, AskPasswordFlags flags, c
int r;
assert(keyname);
assert(passwords);
r = add_to_keyring(keyname, flags, passwords);
if (r < 0)