Windows: Updates Windows Vendoring

Updates windows dependent libraries for vendoing.
This commit is contained in:
Nathan Gieseker
2019-01-23 18:43:18 -08:00
parent a686cc4bd8
commit 9a429d8d25
839 changed files with 282895 additions and 774 deletions

View File

@@ -0,0 +1,53 @@
package safefile
import (
"io/ioutil"
"os"
"path/filepath"
"syscall"
"testing"
winio "github.com/Microsoft/go-winio"
)
func tempRoot() (*os.File, error) {
name, err := ioutil.TempDir("", "hcsshim-test")
if err != nil {
return nil, err
}
f, err := OpenRoot(name)
if err != nil {
os.Remove(name)
return nil, err
}
return f, nil
}
func TestRemoveRelativeReadOnly(t *testing.T) {
root, err := tempRoot()
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(root.Name())
defer root.Close()
p := filepath.Join(root.Name(), "foo")
f, err := os.Create(p)
if err != nil {
t.Fatal(err)
}
defer f.Close()
bi := winio.FileBasicInfo{}
bi.FileAttributes = syscall.FILE_ATTRIBUTE_READONLY
err = winio.SetFileBasicInfo(f, &bi)
if err != nil {
t.Fatal(err)
}
f.Close()
err = RemoveRelative("foo", root)
if err != nil {
t.Fatal(err)
}
}