提交 7fc9c301 作者: Jeromy

close file before removing it in check writeable

License: MIT
Signed-off-by: 's avatarJeromy <jeromyj@gmail.com>
上级 416f0250
...@@ -63,7 +63,8 @@ test_expect_success ".ipfs/ has been created" ' ...@@ -63,7 +63,8 @@ test_expect_success ".ipfs/ has been created" '
test -d ".ipfs" && test -d ".ipfs" &&
test -f ".ipfs/config" && test -f ".ipfs/config" &&
test -d ".ipfs/datastore" && test -d ".ipfs/datastore" &&
test -d ".ipfs/blocks" || test -d ".ipfs/blocks" &&
test ! -f ._check_writeable ||
test_fsh ls -al .ipfs test_fsh ls -al .ipfs
' '
......
...@@ -16,6 +16,7 @@ func Writable(path string) error { ...@@ -16,6 +16,7 @@ func Writable(path string) error {
} }
// Check the directory is writeable // Check the directory is writeable
if f, err := os.Create(filepath.Join(path, "._check_writeable")); err == nil { if f, err := os.Create(filepath.Join(path, "._check_writeable")); err == nil {
f.Close()
os.Remove(f.Name()) os.Remove(f.Name())
} else { } else {
return errors.New("'" + path + "' is not writeable") return errors.New("'" + path + "' is not writeable")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论