From 1b5643103532cd11cbd4432e9c534871c3a34fe9 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 19 Aug 2013 22:41:09 -0500 Subject: in ib_brightness_control_set_value(), log the strerror when write() fails. --- src/ib-brightness-control.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ib-brightness-control.c b/src/ib-brightness-control.c index cf1e5ad..2b9b79d 100644 --- a/src/ib-brightness-control.c +++ b/src/ib-brightness-control.c @@ -18,6 +18,8 @@ */ #include + +#include #include #include #include @@ -75,6 +77,7 @@ ib_brightness_control_set_value (IbBrightnessControl* self, gint value) gchar *filename; gchar *svalue; gint length; + gint err; if (self->path == NULL) return; @@ -90,9 +93,12 @@ ib_brightness_control_set_value (IbBrightnessControl* self, gint value) svalue = g_strdup_printf ("%i", value); length = strlen (svalue); + err = errno; + errno = 0; if (write (fd, svalue, length) != length) { - g_warning ("Fail to write brightness information."); + g_warning ("Fail to write brightness information: %s", g_strerror(errno)); } + errno = err; close (fd); g_free (svalue); -- cgit v1.2.3