bitbake: utils: lock_timeout_nocheck() ensure l is initialized

lock_timeout_nocheck() can be interrupted immediately after enterring
the try-block and prior to initializing 'l', for example with a
ctrl-C, the code in finally will still be run and the 'if l' will
fail. Initialize 'l' as False to avoid this possiblity.

(Bitbake rev: 4885cd9d275ba2ab60e5c76aed856c34533cd3ae)

Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mark Asselstine
2025-04-11 17:01:46 -04:00
committed by Richard Purdie
parent a3a10a15c4
commit da63ef8c75

View File

@@ -1898,6 +1898,7 @@ def lock_timeout(lock):
# A version of lock_timeout without the check that the lock was locked and a shorter timeout
@contextmanager
def lock_timeout_nocheck(lock):
l = False
try:
s = signal.pthread_sigmask(signal.SIG_BLOCK, signal.valid_signals())
l = lock.acquire(timeout=10)