Skip to content

Commit

Permalink
Merge pull request #3636 from ipfs/fix/writeable-file-close
Browse files Browse the repository at this point in the history
close file before removing it in check writeable
  • Loading branch information
whyrusleeping authored Jan 27, 2017
2 parents 65e0704 + 7fc9c30 commit c99a82d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/sharness/t0020-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
'

Expand Down
1 change: 1 addition & 0 deletions thirdparty/dir/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit c99a82d

Please sign in to comment.