提交 871cc6f1 作者: Jeromy

call flush after files rm

License: MIT
Signed-off-by: 's avatarJeromy <jeromyj@gmail.com>
上级 fd4c4122
...@@ -659,6 +659,17 @@ remove files or directories ...@@ -659,6 +659,17 @@ remove files or directories
dashr, _, _ := req.Option("r").Bool() dashr, _, _ := req.Option("r").Bool()
var success bool
defer func() {
if success {
err := pdir.Flush()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
}
}()
// if '-r' specified, don't check file type (in bad scenarios, the block may not exist) // if '-r' specified, don't check file type (in bad scenarios, the block may not exist)
if dashr { if dashr {
err := pdir.Unlink(name) err := pdir.Unlink(name)
...@@ -667,6 +678,7 @@ remove files or directories ...@@ -667,6 +678,7 @@ remove files or directories
return return
} }
success = true
return return
} }
...@@ -686,6 +698,8 @@ remove files or directories ...@@ -686,6 +698,8 @@ remove files or directories
res.SetError(err, cmds.ErrNormal) res.SetError(err, cmds.ErrNormal)
return return
} }
success = true
} }
}, },
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论