[glib] g_cancellable_get_fd: silently return -1 for NULL cancellable



commit ee63179b71f6a4153f08bc5c84c24a0d0ac76263
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Fri Jul 29 15:38:54 2011 -0400

    g_cancellable_get_fd: silently return -1 for NULL cancellable
    
    This keeps compatibility with previous behavior.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=655598
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 gio/gcancellable.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index 1c3c5b5..8ed1b26 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -348,6 +348,9 @@ g_cancellable_get_fd (GCancellable *cancellable)
 {
   GPollFD pollfd;
 
+  if (cancellable == NULL)
+	  return -1;
+
 #ifdef G_OS_WIN32
   pollfd.fd = -1;
 #else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]