@@ -41,7 +41,7 @@ var baseMounts = []*configs.Mount{
41
41
42
42
// setupRootfs sets up the devices, mount points, and filesystems for use inside a
43
43
// new mount namespace.
44
- func setupRootfs (config * configs.Config ) (err error ) {
44
+ func setupRootfs (config * configs.Config , console * linuxConsole ) (err error ) {
45
45
if err := prepareRoot (config ); err != nil {
46
46
return newSystemError (err )
47
47
}
@@ -53,7 +53,7 @@ func setupRootfs(config *configs.Config) (err error) {
53
53
if err := createDevices (config ); err != nil {
54
54
return newSystemError (err )
55
55
}
56
- if err := setupPtmx (config ); err != nil {
56
+ if err := setupPtmx (config , console ); err != nil {
57
57
return newSystemError (err )
58
58
}
59
59
// stdin, stdout and stderr could be pointing to /dev/null from parent namespace.
@@ -255,16 +255,15 @@ func setReadonly() error {
255
255
return syscall .Mount ("/" , "/" , "bind" , syscall .MS_BIND | syscall .MS_REMOUNT | syscall .MS_RDONLY | syscall .MS_REC , "" )
256
256
}
257
257
258
- func setupPtmx (config * configs.Config ) error {
258
+ func setupPtmx (config * configs.Config , console * linuxConsole ) error {
259
259
ptmx := filepath .Join (config .Rootfs , "dev/ptmx" )
260
260
if err := os .Remove (ptmx ); err != nil && ! os .IsNotExist (err ) {
261
261
return err
262
262
}
263
263
if err := os .Symlink ("pts/ptmx" , ptmx ); err != nil {
264
264
return fmt .Errorf ("symlink dev ptmx %s" , err )
265
265
}
266
- if config .Console != "" {
267
- console := newConsoleFromPath (config .Console )
266
+ if console != nil {
268
267
return console .mount (config .Rootfs , config .MountLabel , 0 , 0 )
269
268
}
270
269
return nil
0 commit comments