← Commit list

7ca5c51cc

Bartosz Golaszewski
Bartosz Golaszewski
2015-05-11
SUCCESS Duration: 141s

Subject

i2c-tools: only try /dev/i2c/* if opening /dev/i2c-* fails with ENOENT

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

miscutils/i2c_tools.c+6 -2
@@ -379,8 +379,12 @@ static int i2c_dev_open(int i2cbus)
sprintf(filename, "/dev/i2c-%d", i2cbus);
fd = open(filename, O_RDWR);
if (fd < 0) {
- filename[8] = '/'; /* change to "/dev/i2c/%d" */
- fd = xopen(filename, O_RDWR);
+ if (errno == ENOENT) {
+ filename[8] = '/'; /* change to "/dev/i2c/%d" */
+ fd = xopen(filename, O_RDWR);
+ } else {
+ bb_perror_msg_and_die("can't open '%s'", filename);
+ }
}
return fd;