summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/mktemp.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* GNU ld has prefixed the contents of .gnu.warning.SYMBOL sectionstb2017-11-281-2/+2
| | | | | | | | with "warning: " since 2003, so the messages themselves need not contain the prefix anymore. From Scott Cheloha ok jca, deraadt
* Wrap <stdlib.h> so that calls go direct and the symbols not in theguenther2015-09-131-2/+2
| | | | | | C standard are all weak. Apply __{BEGIN,END}_HIDDEN_DECLS to gdtoa{,imp}.h, hiding the arch-specific __strtorx, __ULtox_D2A, __strtorQ, __ULtoQ_D2A symbols.
* Wrap <unistd.h> so that internal calls go direct and they're all weak symbolsguenther2015-09-121-1/+3
| | | | Delete unused 'fd' argument from internal function oldttyname()
* Add framework for resolving (pun intended) libc namespace issues, usingguenther2015-08-311-3/+1
| | | | | | | | | | | | wrapper .h files and asm labels to let internal calls resolve directly and not be overridable or use the PLT. Then, apply that framework to most of the functions in stdio.h, string.h, err.h, and wchar.h. Delete the should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here. tests clean on i386, amd64, sparc64, powerpc, and mips64 naming feedback from kettenis@ and millert@ ok kettenis@
* Use "const char tempchars[]" instead of "const char *tempchars".millert2014-10-311-2/+2
| | | | | Since tempchars is never reassigned there's no need to indirect through a pointer. Still getting used to this newfangled C89.
* Add additional userland interfaces for setting close-on-exec on fdsguenther2014-08-311-7/+27
| | | | | | | | | | | | | when creating them: mkostemp(), mkostemps(), the 'e' mode letter for fopen(), freopen(), fdopen(), and popen(). The close-on-exec flag will be cleared by the action created by posix_spawn_file_actions_adddup2(). Also, add support for the C11 'x' mode letter for fopen() and freopen(), setting O_EXCL when possibly creating files. Note: this requires kernel support for pipe2() and dup3()! ok millert@
* We don't really need uniform distribution for mktemp(3) so usemillert2014-05-061-6/+19
| | | | | | | arc4random_buf() to avoid lots of arc4random() calls with a getpid() syscall for each one. We fetch 32 bytes of random data at a time which can handle up to 16 Xs. 16 Xs should be enough for anyone. Requested and OK deraadt@
* Return EINVAL if there are fewer than six template Xs in the path.guenther2013-03-121-7/+9
| | | | ok deraadt@ millert@
* signedness fix; ok millertdtucker2011-10-021-2/+2
|
* When all tried file names already existed, mktemp(3) returned withoutschwarze2010-03-211-1/+3
| | | | | | setting errno(2). Behaviour unchanged for mkstemp[s] and mkdtemp. ok guenther deraadt
* The previous commit didn't use the first X in the template if theguenther2010-02-111-3/+2
| | | | | | | entire template was Xs. Test suite written now to keep this from happening again. Problem caught by Vadim Zhukov again. ok millert@
* Don't underrun the buffer when the template is all X's.guenther2010-02-081-7/+2
| | | | | | | Also, remove a duplicate preconditions check. Based on a suggestion by Vadim Zhukov (persgray <at> gmail.com) ok millert@
* Return -1 from mktemp_internal() on EINVAL like we used to.millert2009-03-201-3/+3
| | | | OK oga@ thib@
* New mktemp(3) based on the one from portable mktemp(1). Now includesmillert2009-03-011-89/+88
| | | | | | | digits (in addition to letters) in the random file name. Instead of looping forever, mktemp(3) will terminate when it has tried 2 * N^62 times where N is the number of X's. This is effectively forever for lots of X's.
* when the template is entirely XXX characters, would crashderaadt2009-02-171-4/+6
| | | | | from Vadim Zhukov <persgray@gmail ok millert
* add missing header needed by strlen().chl2008-09-151-1/+2
| | | | ok millert@
* Replace the old algorithm that included the process id as part of themillert2008-08-221-49/+20
| | | | temporary file name with one that only uses random data. OK deraadt@
* Remove useless code, the kernel will set errno appropriately if anmillert2008-08-211-21/+1
| | | | element in the path does not exist. OK deraadt@ pvalchev@
* use arc4random_uniform(); ok djm millertderaadt2008-07-221-2/+2
|
* Comment fix about time consumption of _gettemp.tobias2007-10-211-5/+2
| | | | | | FreeBSD did this in revision 1.20. OK deraadt@, krw@
* zap remaining rcsid.espie2005-08-081-4/+1
| | | | | | Kill old files that are no longer compiled. okay theo
* deregister + ansify, no change in object code. ok deraadt@ millert@otto2004-09-281-18/+8
|
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Don't decrement the current character pointer past the beginning of themillert2002-05-271-3/+3
| | | | buffer passed in. Based on a patch from Mark Andrews. deraadt@ OK
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-3/+3
|
* more pid_t usederaadt2002-01-021-2/+3
|
* add mkstemp(char *template, int suffixlen) interfacederaadt1998-06-301-12/+34
|
* wrap Z->a and z->A; peter@netplex.com.auderaadt1998-04-141-2/+4
|
* uninitialized case; bdederaadt1998-03-041-2/+3
|
* 1) Don't truncate the input string when a directory cannot be stat'dmillert1997-10-071-15/+17
| | | | | 2) Use traditional mktemp(3) semantics. Don't return an error if directories in the path don't exist yet for mktemp(3) only.
* Add mkdtemp(3)millert1997-06-201-7/+24
|
* Change a stat(2) -> lstat(2) to avoid symlink games. From Keithmillert1997-04-071-2/+2
| | | | Bostic <bostic@bostic.com>.
* Pull in stdlib.h for arc4random prototype.millert1997-02-101-1/+2
|
* pre-pad with random alphabetic letters instead of digit 0deraadt1997-02-071-5/+17
|
* back out my last change to avoid the __warn_references on the mips - it'sgraichen1997-01-201-3/+1
| | | | now done for the pmax like for the arc in machine/cdefs.h
* put all the __warn_references behind a #ifndef NO_WARN_REFERENCES whichgraichen1997-01-191-1/+3
| | | | | is then set in the libc Makefile for the mips (the mips linker can't handle them)
* 95% of common uses of these are incorrect and insecure. correct use isderaadt1996-12-281-2/+15
| | | | incredibly rare. Time for some education!
* Fix RCS idstholo1996-08-191-6/+1
| | | | Make sure everything uses {SYS,}LIBC_SCCS properly
* initial import of NetBSD treederaadt1995-10-181-0/+133