mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
project: use vndr for vendoring
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
f54339dfea
commit
f2614f2107
2107 changed files with 99972 additions and 26271 deletions
33
vendor/github.com/Microsoft/hcsshim/utils.go
generated
vendored
Normal file
33
vendor/github.com/Microsoft/hcsshim/utils.go
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
package hcsshim
|
||||
|
||||
import (
|
||||
"io"
|
||||
"syscall"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
)
|
||||
|
||||
// makeOpenFiles calls winio.MakeOpenFile for each handle in a slice but closes all the handles
|
||||
// if there is an error.
|
||||
func makeOpenFiles(hs []syscall.Handle) (_ []io.ReadWriteCloser, err error) {
|
||||
fs := make([]io.ReadWriteCloser, len(hs))
|
||||
for i, h := range hs {
|
||||
if h != syscall.Handle(0) {
|
||||
if err == nil {
|
||||
fs[i], err = winio.MakeOpenFile(h)
|
||||
}
|
||||
if err != nil {
|
||||
syscall.Close(h)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
for _, f := range fs {
|
||||
if f != nil {
|
||||
f.Close()
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
return fs, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue