[Pommed-commits] [SCM] pommed - hotkeys handler for Apple laptops branch, master, updated. 1.29-3-g3d16687

Julien BLACHE jb at jblache.org
Wed Oct 21 20:44:36 UTC 2009


The following commit has been merged in the master branch:
commit 195484d0ad3a6d6617a6f64c07f78478556744f8
Author: Julien BLACHE <jb at jblache.org>
Date:   Wed Oct 21 22:37:54 2009 +0200

    Fix a crasher in the i2c probe device on pmac
    
    The probe routine would crash when fopen() failed with ENOENT due to
    a missing case in the error path. Typically happens when i2c-dev is
    not loaded.

diff --git a/ChangeLog b/ChangeLog
index e007721..e4d1a93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@ ChangeLog for pommed
 --------------------
 
 version 1.30:
+	- pommed: fix a crasher in the i2c probe routine on pmac.
 
 version 1.29:
 	- pommed: add support for newer nvidia backlight driver which
diff --git a/pommed/pmac/kbd_backlight.c b/pommed/pmac/kbd_backlight.c
index f9bb133..0ff0ea6 100644
--- a/pommed/pmac/kbd_backlight.c
+++ b/pommed/pmac/kbd_backlight.c
@@ -404,10 +404,20 @@ kbd_get_i2cdev(void)
 	}
 
       fp = fopen(buf, "r");
-      if ((fp == NULL) && (errno != ENOENT))
+      if (fp == NULL)
 	{
-	  logmsg(LOG_ERR, "Error: i2c device probe: cannot open %s: %s", buf, strerror(errno));
-	  continue;
+	  if (errno != ENOENT)
+	    {
+	      logmsg(LOG_ERR, "Error: i2c device probe: cannot open %s: %s", buf, strerror(errno));
+	      continue;
+	    }
+	  else
+	    {
+	      logmsg(LOG_ERR, "Error: i2c device probe: i2c device not found, is i2c-dev loaded?");
+
+	      i2c_bus = 256;
+	      break;
+	    }
 	}
 
       ret = fread(buf, 1, PATH_MAX - 1, fp);

-- 
pommed - hotkeys handler for Apple laptops



More information about the Pommed-commits mailing list