diff mbox series

[BlueZ,8/8] adapter: Ensure that file exists on IRK write

Message ID 20230725084431.640332-9-simon.mikuda@streamunlimited.com (mailing list archive)
State New, archived
Headers show
Series Various fixes and refactors | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Simon Mikuda July 25, 2023, 8:44 a.m. UTC
---
 src/adapter.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Luiz Augusto von Dentz July 27, 2023, 6:47 p.m. UTC | #1
Hi Simon,

On Tue, Jul 25, 2023 at 1:56 AM Simon Mikuda
<simon.mikuda@streamunlimited.com> wrote:
>
> ---
>  src/adapter.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index 4c3bb091d..fe8ae7604 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -8823,6 +8823,8 @@ static void store_irk(struct btd_adapter *adapter, const bdaddr_t *peer,
>
>         g_key_file_set_string(key_file, "IdentityResolvingKey", "Key", str);
>
> +       create_file(filename, 0600);
> +
>         store_data = g_key_file_to_data(key_file, &length, NULL);
>         if (!g_file_set_contents(filename, store_data, length, &gerr)) {
>                 error("Unable set contents for %s: (%s)", filename,
> --
> 2.34.1

This looks like a fix as well so reword it and send it separately,
also please add the runtime error in the description.
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index 4c3bb091d..fe8ae7604 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -8823,6 +8823,8 @@  static void store_irk(struct btd_adapter *adapter, const bdaddr_t *peer,
 
 	g_key_file_set_string(key_file, "IdentityResolvingKey", "Key", str);
 
+	create_file(filename, 0600);
+
 	store_data = g_key_file_to_data(key_file, &length, NULL);
 	if (!g_file_set_contents(filename, store_data, length, &gerr)) {
 		error("Unable set contents for %s: (%s)", filename,