close file before removing it in check writeable
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Jan 26, 2017 at 22:43 UTC
7fc9c301687075aaf642a73eb12c18acf9d99920
2 files changed
+3
-1
test/sharness/t0020-init.sh
+2
-1
@@ -63,7 +63,8 @@ test_expect_success ".ipfs/ has been created" '
63
test -d ".ipfs" &&
64
test -f ".ipfs/config" &&
65
test -d ".ipfs/datastore" &&
66
- test -d ".ipfs/blocks" ||
66
+ test -d ".ipfs/blocks" &&
67
+ test ! -f ._check_writeable ||
68
test_fsh ls -al .ipfs
69
'
70
thirdparty/dir/dir.go
+1
@@ -16,6 +16,7 @@ func Writable(path string) error {
16
}
17
// Check the directory is writeable
18
if f, err := os.Create(filepath.Join(path, "._check_writeable")); err == nil {
19
+ f.Close()
20
os.Remove(f.Name())
21
} else {
22
return errors.New("'" + path + "' is not writeable")