summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-06-30 18:24:14 +0200
committerTom Gundersen <teg@jklm.no>2015-06-30 18:24:14 +0200
commitb7a049dba57de92bff27917d5125b719c0e43295 (patch)
tree04f6b6bf15d3e6d4e15f055acc0b709c26a68fc5 /src/nspawn
parent2f280f17d9ac6e82c596f2f22b37dd622e13c092 (diff)
parent7fe2bb84c49233ca4da76c0df377819b93571f9c (diff)
Merge pull request #429 from richardmaw-codethink/nspawn-userns-uid-shift-autodetection-fix
nspawn: determine_uid_shift before forking
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index df341a6e74..7fa098bea8 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -4313,10 +4313,6 @@ static int outer_child(
if (r < 0)
return r;
- r = determine_uid_shift(directory);
- if (r < 0)
- return r;
-
/* Turn directory into bind mount */
if (mount(directory, directory, NULL, MS_BIND|MS_REC, NULL) < 0)
return log_error_errno(errno, "Failed to make bind mount: %m");
@@ -4495,6 +4491,10 @@ int main(int argc, char *argv[]) {
if (r < 0)
goto finish;
+ r = determine_uid_shift(arg_directory);
+ if (r < 0)
+ return r;
+
if (geteuid() != 0) {
log_error("Need to be root.");
r = -EPERM;