diff --git a/third-party/rsutils/src/network-adapter-watcher.cpp b/third-party/rsutils/src/network-adapter-watcher.cpp index 98217b3cbd9..ea983632489 100644 --- a/third-party/rsutils/src/network-adapter-watcher.cpp +++ b/third-party/rsutils/src/network-adapter-watcher.cpp @@ -74,11 +74,20 @@ class network_adapter_watcher_singleton NotifyAddrChange( &h_file, &overlap ); // If multiple objects become signaled, the function returns the index of the first handle in the // array whose object was signaled: - if( WAIT_OBJECT_0 - == WaitForMultipleObjects( n_handles, handles, FALSE /*wait-for-all*/, INFINITE ) ) + auto result = WaitForMultipleObjects( n_handles, handles, FALSE /*wait-for-all*/, INFINITE ); + if( WAIT_OBJECT_0 == result ) break; // we're done - LOG_DEBUG( "network adapter changes detected!" ); - callbacks.raise(); + if( ( WAIT_OBJECT_0 + 1 ) == result ) + { + LOG_DEBUG( "network adapter changes detected!" ); + callbacks.raise(); + } + else + { + auto last_error = GetLastError(); + LOG_ERROR( "Network adapter wait failed (" << result << "); GetLastError is " << last_error ); + break; + } } LOG_DEBUG( "exiting network adapter watcher" ); @@ -122,7 +131,7 @@ class network_adapter_watcher_singleton char buf[4096]; struct sockaddr_nl snl; - iovec iov = { buf, sizeof buf }; + iovec iov = { buf, sizeof( buf ) }; msghdr msg = { (void *)&snl, sizeof snl, &iov, 1, NULL, 0, 0 }; int status = recvmsg( _socket, &msg, 0 ); if( status < 0 )