libcontainer/rootfs_linux: minor cleanup

move variable close to where is used

Signed-off-by: Bin Chen <nk@devicu.com>
This commit is contained in:
Bin Chen 2018-04-16 22:18:39 +10:00
parent f753f300ae
commit 1b27db67f1
1 changed files with 2 additions and 1 deletions

View File

@ -46,7 +46,6 @@ func prepareRootfs(pipe io.ReadWriter, iConfig *initConfig) (err error) {
return newSystemErrorWithCause(err, "preparing rootfs")
}
setupDev := needsSetupDev(config)
for _, m := range config.Mounts {
for _, precmd := range m.PremountCmds {
if err := mountCmd(precmd); err != nil {
@ -65,6 +64,8 @@ func prepareRootfs(pipe io.ReadWriter, iConfig *initConfig) (err error) {
}
}
setupDev := needsSetupDev(config)
if setupDev {
if err := createDevices(config); err != nil {
return newSystemErrorWithCause(err, "creating device nodes")