0001-sysrepo-plugind-CHANGE-create-plugins-dir-if-it-does.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 28c27e2001b709a9cae1db0aba2185ec86ba0454 Mon Sep 17 00:00:00 2001
  2. From: Michal Vasko <mvasko@cesnet.cz>
  3. Date: Thu, 19 Dec 2019 14:01:00 +0100
  4. Subject: [PATCH 1/9] sysrepo-plugind CHANGE create plugins dir if it does not
  5. exist
  6. Fixes #1719
  7. [Patch from https://github.com/sysrepo/sysrepo/commit/28c27e2001b709a9cae1db0aba2185ec86ba0454]
  8. Signed-off-by: Heiko Thiery <heiko.thiery@kontron.com>
  9. ---
  10. src/executables/sysrepo-plugind.c | 12 ++++++++++++
  11. 1 file changed, 12 insertions(+)
  12. diff --git a/src/executables/sysrepo-plugind.c b/src/executables/sysrepo-plugind.c
  13. index 6b11bad6..ddb41c26 100644
  14. --- a/src/executables/sysrepo-plugind.c
  15. +++ b/src/executables/sysrepo-plugind.c
  16. @@ -225,6 +225,18 @@ load_plugins(struct srpd_plugin_s **plugins, int *plugin_count)
  17. plugins_dir = SRPD_PLUGINS_PATH;
  18. }
  19. + /* create the directory if it does not exist */
  20. + if (access(plugins_dir, F_OK) == -1) {
  21. + if (errno != ENOENT) {
  22. + error_print(0, "Checking plugins dir existence failed (%s).", strerror(errno));
  23. + return -1;
  24. + }
  25. + if (mkdir(plugins_dir, 00777) == -1) {
  26. + error_print(0, "Creating plugins dir \"%s\" failed (%s).", plugins_dir, strerror(errno));
  27. + return -1;
  28. + }
  29. + }
  30. +
  31. dir = opendir(plugins_dir);
  32. if (!dir) {
  33. error_print(0, "Opening \"%s\" directory failed (%s).", plugins_dir, strerror(errno));
  34. --
  35. 2.20.1