Correctly check whether parent directory is writable for current user.
"&04" was checking if file is readable by others, while "&0200" checks if it's writable for current user. (Fixes #904)
This commit is contained in:
@@ -66,7 +66,7 @@ func Rename(from, to string) error {
|
||||
// containing `path` is writable for the duration of the call.
|
||||
func InWritableDir(fn func(string) error, path string) error {
|
||||
dir := filepath.Dir(path)
|
||||
if info, err := os.Stat(dir); err == nil && info.IsDir() && info.Mode()&04 == 0 {
|
||||
if info, err := os.Stat(dir); err == nil && info.IsDir() && info.Mode()&0200 == 0 {
|
||||
// A non-writeable directory (for this user; we assume that's the
|
||||
// relevant part). Temporarily change the mode so we can delete the
|
||||
// file or directory inside it.
|
||||
|
||||
Reference in New Issue
Block a user