summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-watch.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-05-04 03:22:46 +0000
committerHavoc Pennington <hp@redhat.com>2003-05-04 03:22:46 +0000
commitc0158234d046381a6bc8c004c82577576977d0d7 (patch)
treedd0c727dc8447837d06338083e7da6994431b667 /dbus/dbus-watch.c
parentf60d798c5001070718407febeac42b63ddac314f (diff)
2003-05-03 Havoc Pennington <hp@pobox.com>
* dbus/dbus-watch.c (dbus_watch_handle): warn and return if a watch is invalid when handled * tools/Makefile.am, tools/dbus-launch.c, tools/dbus-launch.1: add dbus-launch utility to launch the bus from a shell script. Didn't actually implement dbus-launch yet, it's just a placeholder still.
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)