summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>2012-10-25 05:12:43 -0700
committerMichael Schuldt <michael.schuldt@bmw.de>2012-10-26 09:14:02 +0300
commit8ef4c0c9073b3b6a7578cffd119fdf0be7963005 (patch)
tree80eaf7c29bbe9c5e968fd962ad62de270d5014b1
parent0942fdc5ddb9b151548f10f9fb5b09b961e79c77 (diff)
downloadlayer_management-8ef4c0c9073b3b6a7578cffd119fdf0be7963005.tar.gz
DbusIpcModule: added checks before calling dbus_watch_handle
-rw-r--r--LayerManagerPlugins/IpcModules/DbusIpcModule/src/message.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/LayerManagerPlugins/IpcModules/DbusIpcModule/src/message.c b/LayerManagerPlugins/IpcModules/DbusIpcModule/src/message.c
index 813249e..5e03465 100644
--- a/LayerManagerPlugins/IpcModules/DbusIpcModule/src/message.c
+++ b/LayerManagerPlugins/IpcModules/DbusIpcModule/src/message.c
@@ -313,13 +313,20 @@ void handleWatchesForFds(fd_set in, fd_set out)
{
DBusWatch* activeWatch = gDbus.incomingWatch[fd];
- pthread_mutex_lock(&gDbus.mutex);
- dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_READABLE);
- pthread_mutex_unlock(&gDbus.mutex);
-
- if (!success)
+ if (activeWatch)
+ {
+ pthread_mutex_lock(&gDbus.mutex);
+ dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_READABLE);
+ pthread_mutex_unlock(&gDbus.mutex);
+
+ if (!success)
+ {
+ printf("incoming dbus_watch_handle() failed\n");
+ }
+ }
+ else
{
- printf("incoming dbus_watch_handle() failed\n");
+ printf("no watch was found for incoming fd %d, not calling dbus_watch_handle(NULL)\n", fd);
}
}
}
@@ -330,13 +337,20 @@ void handleWatchesForFds(fd_set in, fd_set out)
{
DBusWatch* activeWatch = gDbus.outgoingWatch[fd];
- pthread_mutex_lock(&gDbus.mutex);
- dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_WRITABLE);
- pthread_mutex_unlock(&gDbus.mutex);
-
- if (!success)
+ if (activeWatch)
+ {
+ pthread_mutex_lock(&gDbus.mutex);
+ dbus_bool_t success = dbus_watch_handle(activeWatch, DBUS_WATCH_WRITABLE);
+ pthread_mutex_unlock(&gDbus.mutex);
+
+ if (!success)
+ {
+ printf("outgoing dbus_watch_handle() failed\n");
+ }
+ }
+ else
{
- printf("outgoing dbus_watch_handle() failed\n");
+ printf("no watch was found for outgoing fd %d, not calling dbus_watch_handle(NULL)\n", fd);
}
}
}