Commit e25dd198 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9f8828aa
...@@ -63,8 +63,7 @@ public: ...@@ -63,8 +63,7 @@ public:
// XXX empty ctor -> fd=-1, path=? // XXX empty ctor -> fd=-1, path=?
int fd(); int fd();
string name(); string name();
//error close(); error close();
void close();
error stat(struct stat *st); error stat(struct stat *st);
}; };
......
...@@ -248,6 +248,7 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) { ...@@ -248,6 +248,7 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
uint8_t *blkmem = mmap->mem_start + (blk - mmap->blk_start)*f->blksize; uint8_t *blkmem = mmap->mem_start + (blk - mmap->blk_start)*f->blksize;
os::File fsfile; os::File fsfile;
bool fclose = false;
if (at == TidHead) { if (at == TidHead) {
fsfile = f->headf; fsfile = f->headf;
} }
...@@ -257,10 +258,12 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) { ...@@ -257,10 +258,12 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
fmt::sprintf("@%s/bigfile/%s", h_(at), h_(f->foid))); fmt::sprintf("@%s/bigfile/%s", h_(at), h_(f->foid)));
if (err != nil) if (err != nil)
return err; return err;
defer([&]() { // FIXME move out of local scope fclose = true;
fsfile.close();
});
} }
defer([&]() {
if (fclose)
fsfile.close();
});
struct stat st; struct stat st;
err = fsfile.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