[PATCH] Unlink the .pbtmp immediately to not leave leftovers around.
José Fonseca
jose.r.fonseca at gmail.com
Tue Mar 21 14:54:57 UTC 2017
I pushed both changes.
Jose
On Sat, Mar 11, 2017 at 3:14 AM, Alex Tru <alxtry at gmail.com> wrote:
> Oops, that's my fault. This file should not have been even created
> normally. It's only used in profiling. It's still there because of some
> global initialization. I'll make sure the code is not used where
> unnecessary and post a patch soon. Sorry for having this problem.
>
> 2017-03-11 2:20 GMT+03:00 Eric Anholt <eric at anholt.net>:
>
>> 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
>>
>> _______________________________________________
>> apitrace mailing list
>> apitrace at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/apitrace
>>
>
>
> _______________________________________________
> apitrace mailing list
> apitrace at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/apitrace
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/apitrace/attachments/20170321/57fd74bb/attachment.html>
More information about the apitrace
mailing list