From 6f10c216e1514a865b6cfcfc883847da73994277 Mon Sep 17 00:00:00 2001 From: Woongsuk Cho Date: Thu, 17 Oct 2019 10:33:02 +0900 Subject: [PATCH] to avoid gdbus blocking issue, call storage api after process forking --- NativeLauncher/launcher/dotnet/dotnet_launcher.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index 16a9865..58092f7 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -344,9 +344,6 @@ int CoreRuntime::preinitialize(bool standalone) // read string from external file and set them to environment value. setEnvFromFile(); - // Set environment for System.Environment.SpecialFolder - initEnvForSpecialFolder(); - if (initializePathManager(std::string(), std::string(), std::string()) < 0) { _ERR("Failed to initialize PathManager"); return -1; @@ -439,6 +436,12 @@ int CoreRuntime::initialize(bool standalone) if (!standalone) pluginPreload(); + // Set environment for System.Environment.SpecialFolder + // Below function creates dbus connection by callging storage API. + // If dbus connection is created bofere fork(), forked process cannot use dbus. + // To avoid gdbus blocking issue, below function should be called after fork() + initEnvForSpecialFolder(); + fd = open("/proc/self", O_DIRECTORY); std::string appRoot = std::string("/proc/self/fd/") + std::to_string(fd); std::string appBin = concatPath(appRoot, "bin"); -- 2.7.4