[PATCH btbridge v2 6/8] bt_host_write: fix invalid check
OpenBMC Patches
openbmc-patches at stwcx.xyz
Mon Nov 23 21:10:05 AEDT 2015
From: Joel Stanley <joel at jms.id.au>
r is uninitalised, so this check is undefined. Change it to check len
instead.
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
btbridged.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/btbridged.c b/btbridged.c
index 9dbed09..c57843d 100644
--- a/btbridged.c
+++ b/btbridged.c
@@ -361,7 +361,7 @@ static int bt_host_write(struct btbridged_context *context, struct bt_queue *bt_
memcpy(data + 5, bt_msg->rsp.data, bt_msg->rsp.data_len);
/* Count the data[0] byte */
len = write(context->fds[BT_FD].fd, data, data[0] + 1);
- if (r == -1) {
+ if (len == -1) {
r = errno;
MSG_ERR("Error writing to %s: %s\n", BT_HOST_PATH, strerror(errno));
if (bt_msg->call) {
--
2.6.3
More information about the openbmc
mailing list