mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 23:30:07 +01:00
glib-aux: add assertions to nm_utils_fd_wait_for_event()
This commit is contained in:
parent
d5b31a05e6
commit
e80fc43f2a
1 changed files with 9 additions and 0 deletions
|
|
@ -3383,6 +3383,8 @@ nm_utils_fd_wait_for_event(int fd, int event, gint64 timeout_nsec)
|
|||
struct timespec ts, *pts;
|
||||
int r;
|
||||
|
||||
nm_assert(fd >= 0);
|
||||
|
||||
if (timeout_nsec < 0)
|
||||
pts = NULL;
|
||||
else {
|
||||
|
|
@ -3396,6 +3398,13 @@ nm_utils_fd_wait_for_event(int fd, int event, gint64 timeout_nsec)
|
|||
return -NM_ERRNO_NATIVE(errno);
|
||||
if (r == 0)
|
||||
return 0;
|
||||
|
||||
nm_assert(r == 1);
|
||||
nm_assert(pollfd.revents > 0);
|
||||
|
||||
if (pollfd.revents & POLLNVAL)
|
||||
return nm_assert_unreachable_val(-EBADF);
|
||||
|
||||
return pollfd.revents;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue