Commit 0e934dd9 authored by Eugene Kalinin's avatar Eugene Kalinin Committed by Ian Lance Taylor

os: check setStickyBit error in mkdir

If an error occurs, delete the newly created directory.

Change-Id: I97e960d24af32f027fb23d5ce3f61959e73f6fb0
Reviewed-on: https://go-review.googlesource.com/115715
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent bb0fae60
......@@ -221,7 +221,12 @@ func Mkdir(name string, perm FileMode) error {
// mkdir(2) itself won't handle the sticky bit on *BSD and Solaris
if !supportsCreateWithStickyBit && perm&ModeSticky != 0 {
setStickyBit(name)
e = setStickyBit(name)
if e != nil {
Remove(name)
return e
}
}
return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment