Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-ds-flatfs
Commits
ab36d364
Commit
ab36d364
authored
Apr 02, 2018
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove temp file on error in writeDiskUsageFile.
parent
24e5fbe6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
flatfs.go
flatfs.go
+8
-0
No files found.
flatfs.go
View file @
ab36d364
...
...
@@ -868,6 +868,13 @@ func (fs *Datastore) checkpointLoop() {
func
(
fs
*
Datastore
)
writeDiskUsageFile
(
du
int64
,
doSync
bool
)
{
tmp
,
err
:=
ioutil
.
TempFile
(
fs
.
path
,
"du-"
)
removed
:=
false
defer
func
()
{
if
!
removed
{
// silence errcheck
_
=
os
.
Remove
(
tmp
.
Name
())
}
}()
if
err
!=
nil
{
log
.
Warningf
(
"cound not write disk usage: %v"
,
err
)
return
...
...
@@ -897,6 +904,7 @@ func (fs *Datastore) writeDiskUsageFile(du int64, doSync bool) {
log
.
Warningf
(
"cound not write disk usage: %v"
,
err
)
return
}
removed
=
true
fs
.
storedValue
=
toWrite
fs
.
dirty
=
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment