diff --git a/src/miral/launch_app.cpp b/src/miral/launch_app.cpp index bb028aff67a..0087b08e879 100644 --- a/src/miral/launch_app.cpp +++ b/src/miral/launch_app.cpp @@ -29,7 +29,7 @@ namespace { -void strip_mir_env_variables() +auto mir_env_variables() -> std::vector { static char const mir_prefix[] = "MIR_"; @@ -51,10 +51,7 @@ void strip_mir_env_variables() } } - for (auto const& var : vars_to_remove) - { - unsetenv(var.c_str()); - } + return vars_to_remove; } } // namespace @@ -64,6 +61,8 @@ auto miral::launch_app_env( mir::optional_value const& x11_display, miral::AppEnvironment const& app_env) -> pid_t { + static auto const vars_to_remove = mir_env_variables(); + pid_t pid = fork(); if (pid < 0) @@ -73,7 +72,10 @@ auto miral::launch_app_env( if (pid == 0) { - strip_mir_env_variables(); + for (auto const& var : vars_to_remove) + { + unsetenv(var.c_str()); + } if (x11_display) { diff --git a/src/platforms/wayland/cursor.cpp b/src/platforms/wayland/cursor.cpp index 1c0d589d1c5..e4eda7d8f0f 100644 --- a/src/platforms/wayland/cursor.cpp +++ b/src/platforms/wayland/cursor.cpp @@ -41,7 +41,7 @@ struct wl_shm_pool* make_shm_pool(struct wl_shm* shm, int size, void **data) static auto const template_filename = std::string{getenv("XDG_RUNTIME_DIR")} + "/wayland-cursor-shared-XXXXXX"; - auto const filename = strdup(template_filename.c_str()); + char* const filename = const_cast(template_filename.c_str()); mir::Fd const fd{mkostemp(filename, O_CLOEXEC)}; unlink(filename); free(filename);