1
0
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:
Jeromy Johnson
2017-01-27 09:13:09 -08:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@ -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
'

View File

@ -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")