Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The main temporary file not delete on Lzma mode #458

Open
larrylau opened this issue Oct 18, 2015 · 3 comments
Open

The main temporary file not delete on Lzma mode #458

larrylau opened this issue Oct 18, 2015 · 3 comments

Comments

@larrylau
Copy link

The main program will extract On the lzma mode, but The temporary file not delete on exit!

@dicej
Copy link
Member

dicej commented Oct 18, 2015

Thanks for reporting this. Are you using Windows by any chance? My guess is that the unlink call at https://github.com/ReadyTalk/avian/blob/836cc4/src/lzma/load.cpp#L153 isn't working because Windows doesn't allow deleting a file while it is loaded as a library.

One possible solution would be to explicitly unload the library and unlink it after mainFunction returns at https://github.com/ReadyTalk/avian/blob/836cc4/src/lzma/load.cpp#L160. I don't have a machine with Windows handy at the moment to try that, but that's what I would recommend.

@larrylau
Copy link
Author

I used mingw on win7, consider win32api Createfile with flag FILE_FLAG_DELETE_ON_CLOSE ?

@joshuawarner32
Copy link
Collaborator

@larrylau - Something like that will probably work, although you'll likely have to write the file (per the current method), close that handle, then open the handle again with GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE, and FILE_FLAG_DELETE_ON_CLOSE.

CreateProcess will refuse to load a module with writable handles open to it (or indeed, handles that specify FILE_SHARE_WRITE, IIRC), and I'm assuming LoadLibrary will behave similarly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants