[systemd-commits] 2 commits - src/nspawn
Lennart Poettering
lennart at kemper.freedesktop.org
Thu Feb 19 03:03:53 PST 2015
src/nspawn/nspawn.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 6278cf604834ab3535934209a704f222e472bf17
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Feb 19 12:03:39 2015 +0100
nspawn: chown basic device nodes to userns root
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 9967423..0d8d199 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1444,6 +1444,10 @@ static int copy_devnodes(const char *dest) {
if (mknod(to, st.st_mode, st.st_rdev) < 0)
return log_error_errno(errno, "mknod(%s) failed: %m", to);
+
+ if (arg_userns && arg_uid_shift != UID_INVALID)
+ if (lchown(to, arg_uid_shift, arg_uid_shift) < 0)
+ return log_error_errno(errno, "chown() of device node %s failed: %m", to);
}
}
@@ -1460,6 +1464,10 @@ static int setup_ptmx(const char *dest) {
if (symlink("pts/ptmx", p) < 0)
return log_error_errno(errno, "Failed to create /dev/ptmx symlink: %m");
+ if (arg_userns && arg_uid_shift != UID_INVALID)
+ if (lchown(p, arg_uid_shift, arg_uid_shift) < 0)
+ return log_error_errno(errno, "lchown() of symlink %s failed: %m", p);
+
return 0;
}
commit d15d65a01fe02fc66c3a9664fa9eab983f0f5024
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Feb 19 12:03:12 2015 +0100
nspawn: fix build on non-selinux systems
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 8a151f1..9967423 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -872,10 +872,7 @@ static int mount_all(const char *dest) {
int r = 0;
for (k = 0; k < ELEMENTSOF(mount_table); k++) {
- _cleanup_free_ char *where = NULL;
-#ifdef HAVE_SELINUX
- _cleanup_free_ char *options = NULL;
-#endif
+ _cleanup_free_ char *where = NULL, *options = NULL;
const char *o;
int t;
More information about the systemd-commits
mailing list