chiark / gitweb /
switch-root: do not use close old_root_fd after rm_rf_children()
authorHarald Hoyer <harald@redhat.com>
Tue, 22 May 2012 13:28:45 +0000 (15:28 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 22 May 2012 14:15:09 +0000 (16:15 +0200)
rm_rf_children() has already closed the fd with closedir().

src/core/switch-root.c

index ed0a31e6978b3649429f57f83710ed7dc621d52e..9832a520e4ac3f29d6ecfce0e85d181d826fcb3a 100644 (file)
@@ -111,8 +111,10 @@ int switch_root(const char *new_root) {
 
                 if (fstat(old_root_fd, &rb) < 0)
                         log_warning("Failed to stat old root directory, leaving: %m");
-                else
+                else {
                         rm_rf_children(old_root_fd, false, false, &rb);
+                        old_root_fd = -1;
+                }
         }
 
         r = 0;