From fd51c39bb817fd7c602863f7d194aa83fc7c5cf4 Mon Sep 17 00:00:00 2001 From: Simon Busch Date: Tue, 30 Jul 2013 14:21:32 +0000 Subject: [PATCH] Instead of relying on existing service/role directories create them on startup It makes the service start a lot easier when the hub daemon takes care about creating the service/role directories on its own instead of doing this job as part of the init script (which is very close to the daemon anyway). Open-webOS-DCO-1.0-Signed-off-by: Simon Busch --- src/ls-hubd/hub.c | 6 ++++++ src/ls-hubd/security.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/ls-hubd/hub.c b/src/ls-hubd/hub.c index 23d8875..3d5c0ef 100644 --- a/src/ls-hubd/hub.c +++ b/src/ls-hubd/hub.c @@ -1151,6 +1151,12 @@ ParseServiceDirectory(const char *path, LSError *lserror) _ls_verbose("%s: parsing service directory: \"%s\"\n", __func__, path); + if (!g_file_test(path, G_FILE_TEST_IS_DIR)) + { + g_warning("WARNING: service directory \"%s\" does not exist. Attempting to create it ...", path); + g_mkdir(path, 0777); + } + GDir *dir = g_dir_open(path, 0, &gerror); if (!dir) diff --git a/src/ls-hubd/security.c b/src/ls-hubd/security.c index b70f43f..6ad8f83 100644 --- a/src/ls-hubd/security.c +++ b/src/ls-hubd/security.c @@ -1239,6 +1239,12 @@ ParseRoleDirectory(const char *path, GHashTable *role_hash, GHashTable *perm_has _ls_verbose("%s: parsing role directory: \"%s\"\n", __func__, path); + if (!g_file_test(path, G_FILE_TEST_IS_DIR)) + { + g_warning("WARNING: role directory \"%s\" does not exist. Attempting to create it ...", path); + g_mkdir(path, 0777); + } + GDir *dir = g_dir_open(path, 0, &gerror); if (!dir)