utils: lock_timeout_nocheck() ensure `l` is initialized
PATCH 1/1 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.
Signed-off-by Mark Asselstine <[email protected]>
--- lib/bb/utils.py | 1 + 1 file changed, 1 insertion(+)
lib/bb/utils.py +1 -0
@@ -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)
Signature · 1 line
2.39.5