Commit e25dd198 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9f8828aa
......@@ -63,8 +63,7 @@ public:
// XXX empty ctor -> fd=-1, path=?
int fd();
string name();
//error close();
void close();
error close();
error stat(struct stat *st);
};
......
......@@ -248,6 +248,7 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
uint8_t *blkmem = mmap->mem_start + (blk - mmap->blk_start)*f->blksize;
os::File fsfile;
bool fclose = false;
if (at == TidHead) {
fsfile = f->headf;
}
......@@ -257,10 +258,12 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
fmt::sprintf("@%s/bigfile/%s", h_(at), h_(f->foid)));
if (err != nil)
return err;
defer([&]() { // FIXME move out of local scope
fsfile.close();
});
fclose = true;
}
defer([&]() {
if (fclose)
fsfile.close();
});
struct stat st;
err = fsfile.stat(&st);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment