* [PATCH BlueZ] mesh: Fix ignored return value
@ 2019-09-30 9:22 Michał Lowas-Rzechonek
0 siblings, 0 replies; 3+ messages in thread
From: Michał Lowas-Rzechonek @ 2019-09-30 9:22 UTC (permalink / raw)
To: linux-bluetooth
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ] mesh: Fix ignored return value
2019-11-12 14:54 Michał Lowas-Rzechonek
@ 2019-11-13 17:15 ` Gix, Brian
0 siblings, 0 replies; 3+ messages in thread
From: Gix, Brian @ 2019-11-13 17:15 UTC (permalink / raw)
To: michal.lowas-rzechonek, linux-bluetooth
Applied with style-guide corrections:
Blank line ahead of "if"
On Tue, 2019-11-12 at 15:54 +0100, Michał Lowas-Rzechonek wrote:
> 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 9fa7d6bd0..fe292b4a7 100644
> --- a/mesh/keyring.c
> +++ b/mesh/keyring.c
> @@ -140,7 +140,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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH BlueZ] mesh: Fix ignored return value
@ 2019-11-12 14:54 Michał Lowas-Rzechonek
2019-11-13 17:15 ` Gix, Brian
0 siblings, 1 reply; 3+ messages in thread
From: Michał Lowas-Rzechonek @ 2019-11-12 14:54 UTC (permalink / raw)
To: linux-bluetooth
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 9fa7d6bd0..fe292b4a7 100644
--- a/mesh/keyring.c
+++ b/mesh/keyring.c
@@ -140,7 +140,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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-13 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 9:22 [PATCH BlueZ] mesh: Fix ignored return value Michał Lowas-Rzechonek
2019-11-12 14:54 Michał Lowas-Rzechonek
2019-11-13 17:15 ` Gix, Brian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).