about summary refs log tree commit diff
path: root/stdio-common/tst-fdopen.c
Commit message (Collapse)AuthorAgeFilesLines
* Avoid insecure usage of tmpnam in tests.Joseph Myers2018-07-181-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Various glibc testcases use tmpnam in ways subject to race conditions (generate a temporary file name, then later open that file without O_EXCL). This patch fixes those tests to use mkstemp - generally a minimal local fix to use mkstemp instead of tmpnam, rather than a larger fix to use other testsuite infrastructure for temporary files. The unchanged use of tmpnam in posix/wordexp-test.c would fail safe in the event of a race (it's generating a name for use with mkdir rather than for a file to be opened for writing). Tested for x86_64. * grp/tst_fgetgrent.c: Include <unistd.h>. (main): Use mkstemp instead of tmpnam. * io/test-utime.c (main): Likewise. * posix/annexc.c (macrofile): Change to modifiable array. (get_null_defines): Use mkstemp instead of tmpnam. Do not remove macrofile here. * posix/bug-getopt1.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt2.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt3.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt4.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * posix/bug-getopt5.c: Include <stdlib.h>. (do_test): Use mkstemp instead of tmpnam. * stdio-common/bug7.c: Include <stdlib.h> and <unistd.h>. (main): Use mkstemp instead of tmpnam. * stdio-common/tst-fdopen.c: Include <stdlib.h>. (main): Use mkstemp instead of tmpnam. * stdio-common/tst-ungetc.c: Include <stdlib.h>. (main): use mkstemp instead of tmpnam. * stdlib/isomac.c (macrofile): Change to modifiable array. (get_null_defines): Use mkstemp instead of tmpnam. Do not remove macrofile here.
* Update.Ulrich Drepper2002-12-171-0/+1
| | | | | | 2002-12-17 Ulrich Drepper <drepper@redhat.com> * stdio-common/tst-fdopen.c: Undefine assert before redefining it.
* Update.Andreas Jaeger2002-03-241-1/+1
| | | | | | | | | | 2002-03-24 Andreas Jaeger <aj@suse.de> * manual/memory.texi (Aligned Memory Blocks): Fix typo. * stdio-common/tst-fdopen.c (main): Remove unused variable. * iconv/tst-iconv3.c (main): Use correct printf strings.
* Update.Ulrich Drepper2002-02-261-0/+49
2002-02-25 Jakub Jelinek <jakub@redhat.com> * libio/iofopen.c (__fopen_maybe_mmap): Set the initial position to fp->_offset if it is set. * stdio-common/Makefile (tests): Add tst-fdopen. * stdio-common/tst-fdopen.c: New test. 2002-02-25 Jakub Jelinek <jakub@redhat.com> * libio/fileops.c (_IO_file_xsgetn_mmap): Handle reading from backup. * stdio-common/tst-ungetc.c (main): Add another test.