summaryrefslogtreecommitdiff
path: root/meta-openembedded/meta-oe/recipes-core/dbus/dbus-broker/0001-launch-improve-error-handling-for-opendir.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-core/dbus/dbus-broker/0001-launch-improve-error-handling-for-opendir.patch')
-rw-r--r--meta-openembedded/meta-oe/recipes-core/dbus/dbus-broker/0001-launch-improve-error-handling-for-opendir.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-core/dbus/dbus-broker/0001-launch-improve-error-handling-for-opendir.patch b/meta-openembedded/meta-oe/recipes-core/dbus/dbus-broker/0001-launch-improve-error-handling-for-opendir.patch
new file mode 100644
index 000000000..ccc175bb8
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-core/dbus/dbus-broker/0001-launch-improve-error-handling-for-opendir.patch
@@ -0,0 +1,48 @@
+From f42d5e38859c65a186acd0da94bbeeca12faf7a2 Mon Sep 17 00:00:00 2001
+From: David Rheinsberg <david.rheinsberg@gmail.com>
+Date: Thu, 2 May 2019 17:33:34 +0200
+Subject: [PATCH] launch: improve error handling for opendir()
+
+This improves the error-handling of opendir() by always printing
+diagnostics. Furthermore, it aligns the behavior with dbus-deamon and
+ignores EACCES.
+
+Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
+Upstream-Status: dbus-broker@f42d5e38859c65a186acd0da94bbeeca12faf7a2
+---
+ src/launch/launcher.c | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/src/launch/launcher.c b/src/launch/launcher.c
+index 31a5364..2ec4bda 100644
+--- a/src/launch/launcher.c
++++ b/src/launch/launcher.c
+@@ -749,10 +749,23 @@ static int launcher_load_service_dir(Launcher *launcher, const char *dirpath, NS
+
+ dir = opendir(dirpath);
+ if (!dir) {
+- if (errno == ENOENT || errno == ENOTDIR)
++ if (errno == ENOENT || errno == ENOTDIR) {
+ return 0;
+- else
++ } else if (errno == EACCES) {
++ log_append_here(&launcher->log, LOG_ERR, 0, NULL);
++ r = log_commitf(&launcher->log, "Access denied to service directory '%s'\n", dirpath);
++ if (r)
++ return error_fold(r);
++
++ return 0;
++ } else {
++ log_append_here(&launcher->log, LOG_ERR, errno, NULL);
++ r = log_commitf(&launcher->log, "Unable to open service directory '%s': %m\n", dirpath);
++ if (r)
++ return error_fold(r);
++
+ return error_origin(-errno);
++ }
+ }
+
+ r = dirwatch_add(launcher->dirwatch, dirpath);
+--
+2.20.1
+