summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-11-01 13:48:58 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-11-02 23:20:57 +0100
commitb3bca11c180ed300e6d3b97d6cb29d1b0b737aac (patch)
tree35839e6651fed71938029330fb2c402db94c7da3 /src/shared
parentmkosi: Add extra tools tree packages required to run integration tests (diff)
downloadsystemd-b3bca11c180ed300e6d3b97d6cb29d1b0b737aac.tar.xz
systemd-b3bca11c180ed300e6d3b97d6cb29d1b0b737aac.zip
ask-password: Use default timeout if SYSTEMD_ASK_PASSWORD_KEYRING_TIMEOUT_SEC is unset
Follow-up for d9f4dad986dcebd51bdaeb8ba3d2c00cdc0d701e
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ask-password-api.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 0c3156cd27..aa45468402 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -115,7 +115,7 @@ static int touch_ask_password_directory(AskPasswordFlags flags) {
}
static usec_t keyring_cache_timeout(void) {
- static usec_t saved_timeout = USEC_INFINITY;
+ static usec_t saved_timeout = KEYRING_TIMEOUT_USEC;
static bool saved_timeout_set = false;
int r;
@@ -123,9 +123,7 @@ static usec_t keyring_cache_timeout(void) {
return saved_timeout;
const char *e = secure_getenv("SYSTEMD_ASK_PASSWORD_KEYRING_TIMEOUT_SEC");
- if (streq_ptr(e, "default"))
- saved_timeout = KEYRING_TIMEOUT_USEC;
- else if (e) {
+ if (e && !streq(e, "default")) {
r = parse_sec(e, &saved_timeout);
if (r < 0)
log_debug_errno(r, "Invalid value in $SYSTEMD_ASK_PASSWORD_KEYRING_TIMEOUT_SEC, ignoring: %s", e);