All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] i2c-tools: do not fail opening bus if /dev/i2c
@ 2010-08-18 12:33 Florian Fainelli
       [not found] ` <201008181433.50995.ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2010-08-18 12:33 UTC (permalink / raw)
  To: lm-sensors

In case /dev/i2c is not a directory, open_i2c_dev will fail opening
/dev/i2c/<i2cbus> but only handles the ENOENT errno, while we should also
handle ENOTDIR errno because this is the returned error code. The patch
attached fixes the issue.

Signed-off-by: Florian Fainelli <ffainelli@freebox.fr>
--
Index: tools/i2cbusses.c
=================================--- tools/.svn/text-base/i2cbusses.c.svn-base	2010-08-18 14:22:18.000000000 +0200
+++ /tmp/tempfile.2.tmp	2010-08-18 14:33:12.000000000 +0200
@@ -378,7 +378,7 @@
 	sprintf(filename, "/dev/i2c/%d", i2cbus);
 	file = open(filename, O_RDWR);
 
-	if (file < 0 && errno = ENOENT) {
+	if (file < 0 && (errno = ENOENT || errno = ENOTDIR)) {
 		sprintf(filename, "/dev/i2c-%d", i2cbus);
 		file = open(filename, O_RDWR);
 	}


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-18 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-18 12:33 [lm-sensors] [PATCH] i2c-tools: do not fail opening bus if /dev/i2c Florian Fainelli
     [not found] ` <201008181433.50995.ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
2010-08-18 12:43   ` [PATCH] i2c-tools: do not fail opening bus if /dev/i2c is not a directory Jean Delvare
     [not found]     ` <20100818144329.50711481-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-08-18 12:45       ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.