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
a63d692f
Commit
a63d692f
authored
Apr 09, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: ensure that we close the diskusage file, even if we fail to rename it
parent
2284a522
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
flatfs.go
flatfs.go
+6
-0
No files found.
flatfs.go
View file @
a63d692f
...
...
@@ -973,11 +973,16 @@ func (fs *Datastore) writeDiskUsageFile(du int64, doSync bool) {
}
removed
:=
false
closed
:=
false
defer
func
()
{
if
!
closed
{
_
=
tmp
.
Close
()
}
if
!
removed
{
// silence errcheck
_
=
os
.
Remove
(
tmp
.
Name
())
}
}()
toWrite
:=
fs
.
storedValue
...
...
@@ -999,6 +1004,7 @@ func (fs *Datastore) writeDiskUsageFile(du int64, doSync bool) {
log
.
Warnw
(
"cound not write disk usage"
,
"error"
,
err
)
return
}
closed
=
true
if
err
:=
os
.
Rename
(
tmp
.
Name
(),
filepath
.
Join
(
fs
.
path
,
DiskUsageFile
));
err
!=
nil
{
log
.
Warnw
(
"cound not write disk usage"
,
"error"
,
err
)
...
...
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