Commit Graph
13 Commits
Author SHA1 Message Date
Szabolcs Nagy 571744447c include cleanups: remove unused headers and add feature test macros 2013-12-12 05:09:18 +00:00
Rich Felker 38f44d6923 fix (deprecated) mktemp logic and update it to match other temp functions
the access function cannot be used to check for existence, because it
operates using real uid/gid rather than effective to determine
accessibility; this matters for the non-final path components.
instead, use stat. failure of stat is success if only the final
component is missing (ENOENT) and otherwise is failure.
2013-08-02 01:06:53 -04:00
Rich Felker 9a97d103fb remove (no longer useful) namespace-protected __mktemp symbol 2013-08-02 00:52:50 -04:00
Rich Felker 8872e4e481 use memcmp instead of str[n]cmp for temp function XXXXXX checking 2013-02-20 23:01:22 -05:00
Rich Felker 3b00675bf5 remove leftover unused variable in mktemp after refactoring 2013-02-20 22:56:53 -05:00
Rich Felker 2cc63358cd add mkostemp, mkstemps, and mkostemps functions and reorganize temp internals
based on patch contributed by Anthony G. Basile (blueness)

some issues remain with the filename generation algorithm and other
small bugs, but this patch has been sitting around long enough that I
feel it's best to get it committed and then work out any remaining
issues.
2013-02-20 22:43:23 -05:00
Rich Felker aed707f679 remove ugly prng from mk*temp and just re-poll time on retry 2011-07-28 22:03:54 -04:00
Rich Felker bbdcc403ca eliminate mk*temp dependency on snprintf
this helps some tiny programs be even more tiny, and barly increases
code size even if both are used.
2011-07-28 21:48:53 -04:00
Rich Felker 3825847243 another return value fix for mktemp... 2011-06-12 10:25:29 -04:00
Rich Felker 69ecbd0f31 make mktemp match the historic behavior, and update functions that use it
the historic mktemp is supposed to blank the template string on
failure, rather than returning 0. just zero the first character so
that mkstemp and mkdtemp can still retry with O(1) space requirement.
2011-02-19 09:40:07 -05:00
Rich Felker 446b4207cc major improvements to temp file name generator
use current time in nanoseconds and some potentially-random (if aslr
is enabled) pointer values for the initial tempfile name generation,
and step via a cheap linear prng on collisions. limit the number of
retry attempts to prevent denial of service attacks even if an
attacker can guess the filenames.
2011-02-18 17:04:56 -05:00
Rich Felker 5377715ce0 ensure standard functions mk[sd]temp don't depend on removed function mktemp 2011-02-14 19:18:06 -05:00
Rich Felker 0b44a0315b initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00