Skip to content

Commit d505a0c

Browse files
committed
libct: add a defer fd close in createDeviceNode
Signed-off-by: lifubang <[email protected]>
1 parent 421f252 commit d505a0c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libcontainer/rootfs_linux.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,8 @@ func createDeviceNode(rootfs string, node *devices.Device, bind bool) error {
994994
if err != nil {
995995
return fmt.Errorf("mkdir parent of device inode %q: %w", node.Path, err)
996996
}
997+
defer destDir.Close()
998+
997999
if bind {
9981000
return bindMountDeviceNode(destDir, destName, node)
9991001
}

0 commit comments

Comments
 (0)