mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 23:26:21 +00:00
If config keyfile does not exist, create it.
Fixes #1911 Alternative to #2056 Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include <curl/easy.h>
|
#include <curl/easy.h>
|
||||||
@@ -199,6 +200,10 @@ load_custom_keyfile(prof_keyfile_t* keyfile, gchar* filename)
|
|||||||
|
|
||||||
if (g_file_test(keyfile->filename, G_FILE_TEST_EXISTS)) {
|
if (g_file_test(keyfile->filename, G_FILE_TEST_EXISTS)) {
|
||||||
g_chmod(keyfile->filename, S_IRUSR | S_IWUSR);
|
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);
|
return _load_keyfile(keyfile);
|
||||||
|
|||||||
Reference in New Issue
Block a user