mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
console: don't chown(2) the slave PTY
Since the gid=X and mode=Y flags can be set inside config.json as mount options, don't override them with our own defaults. This avoids /dev/pts/* not being owned by tty in a regular container, as well as all of the issues with us implementing grantpt(3) manually. This is the least opinionated approach to take. This patch is part of the console rewrite patchset. Reported-by: Mrunal Patel <mrunalp@gmail.com> Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
// newConsole returns an initialized console that can be used within a container by copying bytes
|
||||
// from the master side to the slave that is attached as the tty for the container's init process.
|
||||
func newConsole(uid, gid int) (Console, error) {
|
||||
func newConsole() (Console, error) {
|
||||
master, err := os.OpenFile("/dev/ptmx", syscall.O_RDWR|syscall.O_NOCTTY|syscall.O_CLOEXEC, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -26,12 +26,6 @@ func newConsole(uid, gid int) (Console, error) {
|
||||
if err := unlockpt(master); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.Chmod(console, 0600); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.Chown(console, uid, gid); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &linuxConsole{
|
||||
slavePath: console,
|
||||
master: master,
|
||||
|
||||
Reference in New Issue
Block a user