]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: and also add comment, making clear chdir() should come late 31210/head
authorLennart Poettering <lennart@poettering.net>
Mon, 5 Feb 2024 16:11:12 +0000 (17:11 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 6 Feb 2024 10:13:28 +0000 (11:13 +0100)
src/nspawn/nspawn.c

index 957bc5821764c4f28939499b363466ad7adaaa2d..48394a3100e226cbef8b2d686a70e7fbafdb13e0 100644 (file)
@@ -3522,6 +3522,9 @@ static int inner_child(
         if (!barrier_place_and_sync(barrier)) /* #5 */
                 return log_error_errno(SYNTHETIC_ERRNO(ESRCH), "Parent died too early");
 
+        /* Note, this should be done this late (💣 and not moved earlier! ðŸ’£), so that all namespacing
+         * changes are already in effect by now, so that any resolved paths here definitely reference
+         * resources inside the container, and not outside of them. */
         if (arg_chdir)
                 if (chdir(arg_chdir) < 0)
                         return log_error_errno(errno, "Failed to change to specified working directory %s: %m", arg_chdir);