From 7fc9c301687075aaf642a73eb12c18acf9d99920 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Thu, 26 Jan 2017 22:43:54 -0800 Subject: [PATCH] close file before removing it in check writeable License: MIT Signed-off-by: Jeromy --- test/sharness/t0020-init.sh | 3 ++- thirdparty/dir/dir.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/sharness/t0020-init.sh b/test/sharness/t0020-init.sh index d54af7d3c..6d2bfa26f 100755 --- a/test/sharness/t0020-init.sh +++ b/test/sharness/t0020-init.sh @@ -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 ' diff --git a/thirdparty/dir/dir.go b/thirdparty/dir/dir.go index 90554dce1..96e383aa5 100644 --- a/thirdparty/dir/dir.go +++ b/thirdparty/dir/dir.go @@ -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")