From 51e9e6ceda19b3c0c5f67ec4b0885edf2a2cca37 Mon Sep 17 00:00:00 2001 From: Max Kunzelmann Date: Fri, 17 Nov 2023 13:40:25 +0100 Subject: [PATCH] Fix retry behaviour in while loop with mlock() If mlock() fails with errno EAGAIN, it should be retried up to five times, which is tracked in the retries variable. However, the `return false` statement after the switch case makes the function return false after the first failed mlock() call. Remove this statement to actually retry up to five times. Signed-off-by: Max Kunzelmann --- password-buffer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/password-buffer.c b/password-buffer.c index b8b7f94..7b1e465 100644 --- a/password-buffer.c +++ b/password-buffer.c @@ -38,7 +38,6 @@ static bool password_buffer_lock(char *addr, size_t size) { swaylock_log_errno(LOG_ERROR, "Unable to mlock() password memory."); return false; } - return false; } return true;