chiark / gitweb /
core: check return value of rm_rf_dangerous and warn if it fails
authorVáclav Pavlín <vpavlin@redhat.com>
Wed, 27 Mar 2013 14:16:35 +0000 (15:16 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 27 Mar 2013 15:59:14 +0000 (11:59 -0400)
src/core/execute.c

index bc876a3..6aa0083 100644 (file)
@@ -1559,10 +1559,19 @@ void exec_context_tmp_dirs_done(ExecContext *c) {
 
         for(dirp = dirs; *dirp; dirp++) {
                 char *dir;
-                rm_rf_dangerous(*dirp, false, true, false);
+                int r;
 
+                r = rm_rf_dangerous(*dirp, false, true, false);
                 dir = dirname(*dirp);
-                rmdir(dir);
+                if (r < 0)
+                        log_warning("Failed to remove content of temporary directory %s: %s",
+                                    dir, strerror(-r));
+                else {
+                        r = rmdir(dir);
+                        if (r < 0)
+                                log_warning("Failed to remove  temporary directory %s: %s",
+                                            dir, strerror(-r));
+                }
 
                 free(*dirp);
         }