From e8c558c9a5038fc1cc696cf7ebd00467ef2b2374 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 18 Aug 2010 20:00:28 +0000 Subject: [PATCH] Properly handle the rare case where /dev/i2c exists but isn't a directory. Patch from Florian Fainelli. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@5854 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + tools/i2cbusses.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ef25032..11dbbdd 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ SVN i2c-stub-from-dump: Use udev settle to speed up initialization Unload i2c-stub automatically if needed Add support for multiple dumps + tools: Properly handle /dev/i2c not being a directory 3.0.2 (2008-11-29) i2c-dev.h: Drop I2C_FUNC_SMBUS_*I2C_BLOCK_2 defines diff --git a/tools/i2cbusses.c b/tools/i2cbusses.c index 693c191..ee0348c 100644 --- a/tools/i2cbusses.c +++ b/tools/i2cbusses.c @@ -378,7 +378,7 @@ int open_i2c_dev(const int i2cbus, char *filename, const int quiet) 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); }