summaryrefslogtreecommitdiffstats
path: root/server/infopipe/infopipe.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-03-08 18:06:42 -0400
committerSimo Sorce <ssorce@redhat.com>2009-03-09 10:53:47 -0400
commit984070b03417b64dce968b8c9074a3cf187b3fa7 (patch)
tree4168a8bcba932e8a8a5d386a7d28dbad6e5826b4 /server/infopipe/infopipe.c
parentea4f00deaa457f8d8262528cf628691ced497c2e (diff)
downloadsssd-984070b03417b64dce968b8c9074a3cf187b3fa7.tar.gz
sssd-984070b03417b64dce968b8c9074a3cf187b3fa7.tar.xz
sssd-984070b03417b64dce968b8c9074a3cf187b3fa7.zip
Improve error handling and replies in the InfoPipe
When detecting an internal error in the InfoPipe, make a best- attempt at sending an error message back to the calling program, instead of simply leaving the client to wait for the timeout.
Diffstat (limited to 'server/infopipe/infopipe.c')
-rw-r--r--server/infopipe/infopipe.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/infopipe/infopipe.c b/server/infopipe/infopipe.c
index 4ec971caa..8d4bfeefa 100644
--- a/server/infopipe/infopipe.c
+++ b/server/infopipe/infopipe.c
@@ -144,11 +144,15 @@ static int infp_monitor_init(struct infp_ctx *infp_ctx)
/* Helper function to return an immediate error message in the event
* of internal error in the InfoPipe to avoid forcing the clients to
* time out waiting for a reply.
+ * This function will make a best effort to send a reply, but if it
+ * fails, clients will simply have to handle the timeout.
*/
void infp_return_failure(struct infp_req_ctx *infp_req, const char *message)
{
DBusMessage *reply;
+ if(infp_req == NULL) return;
+
reply = dbus_message_new_error(infp_req->req_message,
DBUS_ERROR_FAILED,
message);
@@ -172,6 +176,8 @@ void infp_return_success(struct infp_req_ctx *infp_req)
{
DBusMessage *reply;
+ if (infp_req == NULL) return;
+
reply = dbus_message_new_method_return(infp_req->req_message);
/* If the reply was NULL, we ran out of memory, so we won't
* bother trying to queue the message to send. In this case,