From b12521ca21096c54a1ea2bf1ef67ceae1f6c6133 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Thu, 21 Aug 2025 10:28:02 +0200 Subject: [PATCH] If config keyfile does not exist, create it. Fixes #1911 Alternative to #2056 Signed-off-by: Steffen Jaeckel --- src/common.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common.c b/src/common.c index 349b7b7c..22cf750c 100644 --- a/src/common.c +++ b/src/common.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -199,6 +200,10 @@ load_custom_keyfile(prof_keyfile_t* keyfile, gchar* filename) if (g_file_test(keyfile->filename, G_FILE_TEST_EXISTS)) { g_chmod(keyfile->filename, S_IRUSR | S_IWUSR); + } else { + int fno = g_creat(keyfile->filename, S_IRUSR | S_IWUSR); + if (fno != -1) + g_close(fno, NULL); } return _load_keyfile(keyfile);