]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: Use in_child_chown() in one more place 38152/head
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Fri, 4 Jul 2025 19:21:35 +0000 (21:21 +0200)
committerDaanDeMeyer <daan.j.demeyer@gmail.com>
Thu, 10 Jul 2025 11:55:45 +0000 (13:55 +0200)
src/nspawn/nspawn.c

index f0cfd4f1aad8a072d4815677e430dcecf3645d66..efe6e535c430485ee6180a91a72c13571521b2c1 100644 (file)
@@ -2485,7 +2485,7 @@ static int setup_credentials(const char *root) {
                 if (fchmod(fd, world_readable ? 0444 : 0400) < 0)
                         return log_error_errno(errno, "Failed to adjust access mode of %s: %m", j);
 
-                if (arg_userns_mode != USER_NAMESPACE_NO)
+                if (in_child_chown())
                         if (fchown(fd, arg_uid_shift, arg_uid_shift) < 0)
                                 return log_error_errno(errno, "Failed to adjust ownership of %s: %m", j);
         }