]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
switch-root: add a comment regarding the safety limits of rm_rf_children()
authorLennart Poettering <lennart@poettering.net>
Mon, 15 May 2023 19:31:38 +0000 (21:31 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 May 2023 16:42:01 +0000 (01:42 +0900)
src/shared/switch-root.c

index fa438b3c065f5a55328f427550cd916b3c23703e..1ee06c8ee4db8901dd10d8db24936934f17713bc 100644 (file)
@@ -130,6 +130,8 @@ int switch_root(const char *new_root,
                 if (fstat(old_root_fd, &rb) < 0)
                         return log_error_errno(errno, "Failed to stat old root directory: %m");
 
+                /* Note: the below won't operate on non-memory file systems (i.e. only on tmpfs, ramfs), and
+                 * it will stop at mount boundaries */
                 (void) rm_rf_children(TAKE_FD(old_root_fd), 0, &rb); /* takes possession of the dir fd, even on failure */
         }