[systemd-devel] [PATCH 1/3] core: check return value of rm_rf_dangerous and warn if it fails

Vaclav Pavlin vpavlin at redhat.com
Wed Mar 27 07:16:35 PDT 2013


From: Václav Pavlín <vpavlin at redhat.com>

---
 src/core/execute.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/core/execute.c b/src/core/execute.c
index bc876a3..936e7d8 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1559,10 +1559,16 @@ void exec_context_tmp_dirs_done(ExecContext *c) {
 
         for(dirp = dirs; *dirp; dirp++) {
                 char *dir;
-                rm_rf_dangerous(*dirp, false, true, false);
+                int r=0;
 
+                r = rm_rf_dangerous(*dirp, false, true, false);
                 dir = dirname(*dirp);
-                rmdir(dir);
+                if (r<0)
+                        log_warning("Failed to remove content of tmp_dir %s.", dir);
+                else {
+                        dir = dirname(*dirp);
+                        rmdir(dir);
+                }
 
                 free(*dirp);
         }
-- 
1.8.1.4



More information about the systemd-devel mailing list