summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-watch.c
diff options
context:
space:
mode:
Diffstat (limited to 'dbus/dbus-watch.c')
-rw-r--r--dbus/dbus-watch.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c
index 18044e49..55b182b2 100644
--- a/dbus/dbus-watch.c
+++ b/dbus/dbus-watch.c
@@ -565,6 +565,17 @@ dbus_bool_t
dbus_watch_handle (DBusWatch *watch,
unsigned int flags)
{
+#ifndef DBUS_DISABLE_CHECKS
+ if (watch->fd < 0 || watch->flags == 0)
+ {
+ _dbus_warn ("%s: Watch is invalid, it should have been removed\n",
+ _DBUS_FUNCTION_NAME);
+ return TRUE;
+ }
+#endif
+
+ _dbus_return_val_if_fail (watch->fd >= 0 /* fails if watch was removed */, TRUE);
+
_dbus_watch_sanitize_condition (watch, &flags);
if (flags == 0)