[PATCH] Unlink the .pbtmp immediately to not leave leftovers around.
Eric Anholt
eric at anholt.net
Fri Mar 10 23:20:05 UTC 2017
If apitrace was to crash or get killed, the destructor wouldn't get
called and the temp would get left on disk. Nothing else re-opens the
file, so just unlink it immediately.
---
retrace/mmap_allocator.hpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/retrace/mmap_allocator.hpp b/retrace/mmap_allocator.hpp
index adc08bbe2c1a..e6318aba9dc0 100644
--- a/retrace/mmap_allocator.hpp
+++ b/retrace/mmap_allocator.hpp
@@ -56,7 +56,6 @@ private:
const size_t chunkSize;
std::list<void*> mmaps;
void* vptr;
- std::string fileName;
MmapedFileBuffer(MmapedFileBuffer const&) = delete;
@@ -80,7 +79,7 @@ public:
{
char templ[] = ".pbtmpXXXXXX";
fd = mkstemp(templ);
- fileName = templ;
+ unlink(templ);
newMmap();
}
@@ -89,7 +88,6 @@ public:
for (auto &m : mmaps) {
munmap(m, chunkSize);
}
- unlink(fileName.c_str());
}
void* allocate(size_t size) {
--
2.11.0
More information about the apitrace
mailing list