Browse Source
bug fix: WriteFileAtomic
Must close file before rename it.
pull/1780/head
Mohanson
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
0 deletions
-
common/os.go
|
|
@ -148,6 +148,7 @@ func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error { |
|
|
|
} else if n < len(data) { |
|
|
|
return io.ErrShortWrite |
|
|
|
} |
|
|
|
f.Close() |
|
|
|
|
|
|
|
return os.Rename(f.Name(), filename) |
|
|
|
} |
|
|
|