aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartekgola@gmail.com>2015-10-27 17:15:05 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-11-01 20:55:10 +0100
commit5ed6989d805535804fcd05ddc777fbae48d21f3a (patch)
tree3a0467badbd64afecacb63c931651db9597234ca /miscutils
parent74bb9d5e63b0928ceac57fedd4a2d383129ade7d (diff)
downloadbusybox-5ed6989d805535804fcd05ddc777fbae48d21f3a.tar.gz
i2cdump: display the numeric value for block read ioctl() errors
This makes busybox i2cdump compatible with the upstream version, which also displays the numeric error value in case of a block read failure. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/i2c_tools.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 7be489036..e19d851fe 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -732,8 +732,10 @@ static int read_block_data(int buf_fd, int mode, int *block)
tmp = i2c_smbus_read_i2c_block_data(
buf_fd, res, I2C_SMBUS_BLOCK_MAX,
cblock + res);
- if (tmp <= 0)
+ if (tmp <= 0) {
+ blen = tmp;
goto fail;
+ }
}
if (res >= I2CDUMP_NUM_REGS)
@@ -750,7 +752,7 @@ static int read_block_data(int buf_fd, int mode, int *block)
return blen;
fail:
- bb_error_msg_and_die("block read failed");
+ bb_error_msg_and_die("block read failed: %d", blen);
}
/* Dump all but word data. */