2019-09-30 09:23:20

by Michał Lowas-Rzechonek

[permalink] [raw]
Subject: [PATCH BlueZ] mesh: Fix ignored return value

This fixes the following build error when compiling in maintainer mode:

mesh/keyring.c: In function ‘finalize’:
mesh/keyring.c:142:8: error: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Werror=unused-result]
(void)write(fd, &key, sizeof(key));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
mesh/keyring.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mesh/keyring.c b/mesh/keyring.c
index 3a7f92f9f..806ea153c 100644
--- a/mesh/keyring.c
+++ b/mesh/keyring.c
@@ -139,7 +139,8 @@ static void finalize(const char *fpath, uint16_t net_idx)
l_debug("Finalize %s", fpath);
memcpy(key.old_key, key.new_key, 16);
lseek(fd, 0, SEEK_SET);
- write(fd, &key, sizeof(key));
+ if (write(fd, &key, sizeof(key)) != sizeof(key))
+ goto done;

done:
close(fd);
--
2.19.1