From c0158234d046381a6bc8c004c82577576977d0d7 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 4 May 2003 03:22:46 +0000 Subject: 2003-05-03 Havoc Pennington * 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. --- dbus/dbus-watch.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'dbus/dbus-watch.c') 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) -- cgit