mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-01 10:49:24 +08:00
Merge pull request #3636 from ipfs/fix/writeable-file-close
close file before removing it in check writeable
This commit is contained in:
@ -63,7 +63,8 @@ test_expect_success ".ipfs/ has been created" '
|
||||
test -d ".ipfs" &&
|
||||
test -f ".ipfs/config" &&
|
||||
test -d ".ipfs/datastore" &&
|
||||
test -d ".ipfs/blocks" ||
|
||||
test -d ".ipfs/blocks" &&
|
||||
test ! -f ._check_writeable ||
|
||||
test_fsh ls -al .ipfs
|
||||
'
|
||||
|
||||
|
1
thirdparty/dir/dir.go
vendored
1
thirdparty/dir/dir.go
vendored
@ -16,6 +16,7 @@ func Writable(path string) error {
|
||||
}
|
||||
// Check the directory is writeable
|
||||
if f, err := os.Create(filepath.Join(path, "._check_writeable")); err == nil {
|
||||
f.Close()
|
||||
os.Remove(f.Name())
|
||||
} else {
|
||||
return errors.New("'" + path + "' is not writeable")
|
||||
|
Reference in New Issue
Block a user