aboutsummaryrefslogtreecommitdiff
path: root/src/os/file.go
diff options
context:
space:
mode:
authorGeorge Adams <georgeadams1995@gmail.com>2024-11-19 10:05:27 +0000
committerGopher Robot <gobot@golang.org>2024-11-19 17:26:40 +0000
commit5deea4c2425fd8aa6dee642c63a1bc43e090d04b (patch)
tree081b394780d619b01d8b02aeea61833ed84530fc /src/os/file.go
parent405a0c4ae86fe2761118ee6d1d59e59daf9b50cd (diff)
downloadgo-5deea4c2425fd8aa6dee642c63a1bc43e090d04b.tar.xz
Revert "os: check for valid Windows path when creating files"
This reverts commit CL 618496. Reason for revert: https://github.com/golang/go/issues/54040#issuecomment-2485151973 Change-Id: I3bf27f7fdd475a005cb6aa190994153504e96fb5 Reviewed-on: https://go-review.googlesource.com/c/go/+/629595 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/os/file.go')
-rw-r--r--src/os/file.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/os/file.go b/src/os/file.go
index c75606d749..0341469e2d 100644
--- a/src/os/file.go
+++ b/src/os/file.go
@@ -305,18 +305,25 @@ func (f *File) WriteString(s string) (n int, err error) {
// bits (before umask).
// If there is an error, it will be of type *PathError.
func Mkdir(name string, perm FileMode) error {
- err := mkdir(name, perm)
- if err != nil {
- return &PathError{Op: "mkdir", Path: name, Err: err}
+ longName := fixLongPath(name)
+ e := ignoringEINTR(func() error {
+ return syscall.Mkdir(longName, syscallMode(perm))
+ })
+
+ if e != nil {
+ return &PathError{Op: "mkdir", Path: name, Err: e}
}
+
// mkdir(2) itself won't handle the sticky bit on *BSD and Solaris
if !supportsCreateWithStickyBit && perm&ModeSticky != 0 {
- err = setStickyBit(name)
- if err != nil {
+ e = setStickyBit(name)
+
+ if e != nil {
Remove(name)
- return err
+ return e
}
}
+
return nil
}