mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 07:38:54 +02:00
gcancellable: Assert that make_pollfd() call succeeds
The `make_pollfd()` call can’t fail because it only does so if `cancellable == NULL`, and we’ve already checked that. Assert that’s the case, to shut Coverity up and to catch behavioural changes in future. Coverity CID: #1159433 Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
@@ -348,6 +348,9 @@ int
|
|||||||
g_cancellable_get_fd (GCancellable *cancellable)
|
g_cancellable_get_fd (GCancellable *cancellable)
|
||||||
{
|
{
|
||||||
GPollFD pollfd;
|
GPollFD pollfd;
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
|
gboolean retval;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cancellable == NULL)
|
if (cancellable == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -355,7 +358,8 @@ g_cancellable_get_fd (GCancellable *cancellable)
|
|||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
pollfd.fd = -1;
|
pollfd.fd = -1;
|
||||||
#else
|
#else
|
||||||
g_cancellable_make_pollfd (cancellable, &pollfd);
|
retval = g_cancellable_make_pollfd (cancellable, &pollfd);
|
||||||
|
g_assert (retval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return pollfd.fd;
|
return pollfd.fd;
|
||||||
|
Reference in New Issue
Block a user