summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-14 09:30:26 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-14 10:25:47 +0200
commit1f991aa6e0d90f3006b0d6cc5f04af4193e01d79 (patch)
treeff125c1d961e8754eca5790cfccd455044104bda /src
parentfed403c167706febbb261f994a3c0aea39c166ca (diff)
downloadupower-1f991aa6e0d90f3006b0d6cc5f04af4193e01d79.tar.gz
daemon: Avoid trying to close fd that wasn't opened
If we fail to open the fd for the sysfs keyboard backlight control file, don't try to close it.
Diffstat (limited to 'src')
-rw-r--r--src/up-kbd-backlight.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/up-kbd-backlight.c b/src/up-kbd-backlight.c
index fc34cd7..17d31cd 100644
--- a/src/up-kbd-backlight.c
+++ b/src/up-kbd-backlight.c
@@ -300,7 +300,8 @@ up_kbd_backlight_finalize (GObject *object)
kbd_backlight->priv = UP_KBD_BACKLIGHT_GET_PRIVATE (kbd_backlight);
/* close file */
- close (kbd_backlight->priv->fd);
+ if (kbd_backlight->priv->fd >= 0)
+ close (kbd_backlight->priv->fd);
G_OBJECT_CLASS (up_kbd_backlight_parent_class)->finalize (object);
}