1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-22 07:42:37 +00:00

fix: silence bugprone-unchecked-optional-access warnings (#6990)

* fix: silence bugprone-unchecked-optional-access warnings

clang-tidy emits bugprone-unchecked-optional-access warning for
`tr_sys_file_lock`. however, this is a false positive: the lines
warned about cannot be reached if the optional does not contain a value.
adding an `assert` silences these warnings.

* Apply suggestions from code review
This commit is contained in:
Robin Seth Ekman 2024-08-13 02:51:05 +02:00 committed by GitHub
parent 35ef8cf7a0
commit 0279f37377
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -986,6 +986,7 @@ bool tr_sys_file_lock([[maybe_unused]] tr_sys_file_t handle, [[maybe_unused]] in
#endif
TR_ASSERT(result);
if (!*result && errno == EAGAIN)
{
errno = EWOULDBLOCK;