diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2011-10-08 09:41:42 +1100 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2011-10-08 09:41:42 +1100 |
commit | 155cde625dfc4aa70ee90e9916dc929784f5354c (patch) | |
tree | 9edc28b14520880c767ee6b50cb815d1be0a296c /liblightdm-gobject/greeter.c | |
parent | 284fbbf29f71334fa384ec62eee5981002ed07f8 (diff) | |
download | lightdm-155cde625dfc4aa70ee90e9916dc929784f5354c.tar.gz |
Use paranoid error checking in liblightdm-gobject
Diffstat (limited to 'liblightdm-gobject/greeter.c')
-rw-r--r-- | liblightdm-gobject/greeter.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/liblightdm-gobject/greeter.c b/liblightdm-gobject/greeter.c index a0ee966e..3c10007e 100644 --- a/liblightdm-gobject/greeter.c +++ b/liblightdm-gobject/greeter.c @@ -122,13 +122,15 @@ static void write_message (LightDMGreeter *greeter, guint8 *message, gsize message_length) { LightDMGreeterPrivate *priv = GET_PRIVATE (greeter); + GIOStatus status; GError *error = NULL; - if (g_io_channel_write_chars (priv->to_server_channel, (gchar *) message, message_length, NULL, NULL) != G_IO_STATUS_NORMAL) + status = g_io_channel_write_chars (priv->to_server_channel, (gchar *) message, message_length, NULL, &error); + if (error) g_warning ("Error writing to daemon: %s", error->message); - else - g_debug ("Wrote %zi bytes to daemon", message_length); g_clear_error (&error); + if (status == G_IO_STATUS_NORMAL) + g_debug ("Wrote %zi bytes to daemon", message_length); g_io_channel_flush (priv->to_server_channel, NULL); } @@ -373,7 +375,7 @@ read_message (LightDMGreeter *greeter, gsize *length, gboolean block) n_to_read - priv->n_read, &n_read, &error); - if (status == G_IO_STATUS_ERROR) + if (error) g_warning ("Error reading from server: %s", error->message); g_clear_error (&error); if (status != G_IO_STATUS_NORMAL) |