From 28c27e2001b709a9cae1db0aba2185ec86ba0454 Mon Sep 17 00:00:00 2001 From: Michal Vasko Date: Thu, 19 Dec 2019 14:01:00 +0100 Subject: [PATCH 1/9] sysrepo-plugind CHANGE create plugins dir if it does not exist Fixes #1719 [Patch from https://github.com/sysrepo/sysrepo/commit/28c27e2001b709a9cae1db0aba2185ec86ba0454] Signed-off-by: Heiko Thiery --- src/executables/sysrepo-plugind.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/executables/sysrepo-plugind.c b/src/executables/sysrepo-plugind.c index 6b11bad6..ddb41c26 100644 --- a/src/executables/sysrepo-plugind.c +++ b/src/executables/sysrepo-plugind.c @@ -225,6 +225,18 @@ load_plugins(struct srpd_plugin_s **plugins, int *plugin_count) plugins_dir = SRPD_PLUGINS_PATH; } + /* create the directory if it does not exist */ + if (access(plugins_dir, F_OK) == -1) { + if (errno != ENOENT) { + error_print(0, "Checking plugins dir existence failed (%s).", strerror(errno)); + return -1; + } + if (mkdir(plugins_dir, 00777) == -1) { + error_print(0, "Creating plugins dir \"%s\" failed (%s).", plugins_dir, strerror(errno)); + return -1; + } + } + dir = opendir(plugins_dir); if (!dir) { error_print(0, "Opening \"%s\" directory failed (%s).", plugins_dir, strerror(errno)); -- 2.20.1