summaryrefslogtreecommitdiff
path: root/core/systemd/0014-execute-free-directory-path-if-we-fail-to-remove-it-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'core/systemd/0014-execute-free-directory-path-if-we-fail-to-remove-it-.patch')
-rw-r--r--core/systemd/0014-execute-free-directory-path-if-we-fail-to-remove-it-.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/core/systemd/0014-execute-free-directory-path-if-we-fail-to-remove-it-.patch b/core/systemd/0014-execute-free-directory-path-if-we-fail-to-remove-it-.patch
new file mode 100644
index 000000000..4a48353a4
--- /dev/null
+++ b/core/systemd/0014-execute-free-directory-path-if-we-fail-to-remove-it-.patch
@@ -0,0 +1,54 @@
+From 98b47d54ce946ad3524f84eb38d2413498a333dc Mon Sep 17 00:00:00 2001
+From: Lennart Poettering <lennart@poettering.net>
+Date: Mon, 3 Mar 2014 17:11:39 +0100
+Subject: [PATCH] execute: free directory path if we fail to remove it because
+ we cannot allocate a thread
+
+---
+ src/core/execute.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/src/core/execute.c b/src/core/execute.c
+index 9de6e87..3312885 100644
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -2713,6 +2713,8 @@ static void *remove_tmpdir_thread(void *p) {
+ }
+
+ void exec_runtime_destroy(ExecRuntime *rt) {
++ int r;
++
+ if (!rt)
+ return;
+
+@@ -2722,13 +2724,25 @@ void exec_runtime_destroy(ExecRuntime *rt) {
+
+ if (rt->tmp_dir) {
+ log_debug("Spawning thread to nuke %s", rt->tmp_dir);
+- asynchronous_job(remove_tmpdir_thread, rt->tmp_dir);
++
++ r = asynchronous_job(remove_tmpdir_thread, rt->tmp_dir);
++ if (r < 0) {
++ log_warning("Failed to nuke %s: %s", rt->tmp_dir, strerror(-r));
++ free(rt->tmp_dir);
++ }
++
+ rt->tmp_dir = NULL;
+ }
+
+ if (rt->var_tmp_dir) {
+ log_debug("Spawning thread to nuke %s", rt->var_tmp_dir);
+- asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir);
++
++ r = asynchronous_job(remove_tmpdir_thread, rt->var_tmp_dir);
++ if (r < 0) {
++ log_warning("Failed to nuke %s: %s", rt->var_tmp_dir, strerror(-r));
++ free(rt->var_tmp_dir);
++ }
++
+ rt->var_tmp_dir = NULL;
+ }
+
+--
+1.9.0
+