mirror of
https://github.com/golang/go
synced 2024-11-26 04:17:59 -07:00
os: don't check non-nil err twice in Symlink on windows
Change-Id: I398d324723025b559fdca783fc334de9be68f2d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/314030 Trust: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
0b9ca4d907
commit
88a8a27056
@ -365,17 +365,14 @@ func Symlink(oldname, newname string) error {
|
||||
flags |= syscall.SYMBOLIC_LINK_FLAG_DIRECTORY
|
||||
}
|
||||
err = syscall.CreateSymbolicLink(n, o, flags)
|
||||
|
||||
if err != nil {
|
||||
// the unprivileged create flag is unsupported
|
||||
// below Windows 10 (1703, v10.0.14972). retry without it.
|
||||
flags &^= windows.SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
|
||||
|
||||
err = syscall.CreateSymbolicLink(n, o, flags)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return &LinkError{"symlink", oldname, newname, err}
|
||||
if err != nil {
|
||||
return &LinkError{"symlink", oldname, newname, err}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user