I have applied a little bit different implementation. Please, git
pull
and test it. Thanks for your report!
Oh yes, your implementation is clearly better and I can confirm it
works.
In the meantime mutt started to use mkdtemp ... But that's up to
'official' mutt to handle.
Thank you
--
Vlad