-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
fix mktemp linker warnings when using GNU linker #132
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR which finally might solve the annoying warning and all the previous attempts to get rid of it. I added some comments to your changes and will merge after treatment.
@svillemot The changes look very good to me now. Before merging I'd like to get your feedback. Do you see any issues with mkdtemp on Debian platforms? Should we enable mkdtemp only for POSIX systems? Thanks a lot. |
No problem for using |
@tbeu Any further changes that you need me to make to this? What platforms do you support besides Windows/Linux/macOS? Apart from Windows, looks like AIX is the main one that's missing mkdtemp: Solaris provides it, however: |
No, it all looks fine. I only was reluctant to merge since @svillemot mentioned MinGW. I need to give it one more try after I observed no issues when I tested it locally last time. |
Use mkdtemp() to create a temporary directory with a unique name, then add a constant filename to the path after that. This allows us to construct a unique path without any race conditions, and without having to use mktemp().
(1) Now creates the temporary directory in /tmp on Linux, instead of in the current working directory. (2) Will now delete the temporary directory as well before the function returns (was only deleting the temporary file before). (3) Now uses a buffer on the stack instead of malloc() when constructing the paths, to avoid memory leaks due to Mat_Critical() never returning to caller, and to optimize for better performance.
I rebased (and force-pushed) your branch to confirm that it builds with MinGW.
I have no chance to build on AIX. I believe we should exclude it from the two readme files, where AIX is mentioned as supported platform. OK for you? |
Yeah, excluding AIX sounds good to me. I don't have any way to test on it, either. |
Thanks for the pull request. |
Use mkdtemp() to create a temporary directory with a unique name,
then add a constant filename to the path after that. This allows
us to construct a unique path without any race conditions, and
without having to use mktemp().
Hopefully doing it this way avoids the issues you were having
with getting mkstemp() to work in #43.