Make Temporary Directory With POSIX.1-2001
A program I'm working on needs a temporary directory. However, I would like to stick to POSIX.1-2001. With this constraint, is there a way around using tmpnam
? I know the security problems, but that isn't a concern of mine. The reason for me not to use it is that it is marked obsolete in POSIX.1-2008. At what point will obsolete functions be removed?
Answer
In POSIX 2001 (2004), you'll probably have to use mktemp()
to create the name and then mkdir()
to create a directory with that name. This could lead to TOCTOU (time-of-check, time-of-use) problems with symlinks etc. However, with that said, the mktemp()
function does not appear in POSIX 2008 (so functions are removed sometimes), but it is probably in the library of every system still. The tmpnam()
function is present in both versions of POSIX.
In POSIX 2008, you'd be able to use mkdtemp()
instead, which has security advantages.
Related Questions
- → OctoberCMS Backend Loging Hash Error
- → "failed to open stream" error when executing "migrate:make"
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → Create plugin that makes objects from model in back-end
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → How to install console for plugin development in October CMS
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → October CMS - Conditionally Load a Different Page