From 06d91f546f3898982d3b3d4c6869bfc270a7553e Mon Sep 17 00:00:00 2001 From: Chun Chen Date: Wed, 30 Sep 2015 16:05:49 +0800 Subject: [PATCH] Fix reOpenDevNull We should open /dev/null with os.O_RDWR, otherwise it won't be possible writen to it Signed-off-by: Chun Chen --- libcontainer/rootfs_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcontainer/rootfs_linux.go b/libcontainer/rootfs_linux.go index 3e3a7d2e..d4cb3961 100644 --- a/libcontainer/rootfs_linux.go +++ b/libcontainer/rootfs_linux.go @@ -332,7 +332,7 @@ func setupDevSymlinks(rootfs string) error { // symlinks are resolved locally. func reOpenDevNull() error { var stat, devNullStat syscall.Stat_t - file, err := os.Open("/dev/null") + file, err := os.OpenFile("/dev/null", os.O_RDWR, 0) if err != nil { return fmt.Errorf("Failed to open /dev/null - %s", err) }