summaryrefslogtreecommitdiffstats
path: root/tests/c-api/test-last-errno.c
Commit message (Collapse)AuthorAgeFilesLines
* tests: Fix broken workarounds for missing O_CLOEXEC.Richard W.M. Jones2012-06-281-1/+1
| | | | (cherry picked from commit 35882ba97722ddf9b4c55a332961b08ad8240dd7)
* Use O_CLOEXEC / SOCK_CLOEXEC for almost all file descriptors.Richard W.M. Jones2012-03-141-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | The presumption is that all file descriptors should be created with the close-on-exec flag set. The only exception are file descriptors that we want passed through to exec'd subprocesses (mainly pipes and stdin/stdout/stderr). For open calls, we pass O_CLOEXEC as an extra flag, eg: fd = open ("foo", O_RDONLY|O_CLOEXEC); This is a Linux-ism, but using a macro we can easily make it portable. For sockets, similarly: sock = socket (..., SOCK_STREAM|SOCK_CLOEXEC, ...); For accepted sockets, we use the Linux accept4 system call which allows flags to be supplied, but we use the Gnulib 'accept4' module to make this portable. For dup, dup2, we use the Linux dup3 system call, and the Gnulib modules 'dup3' and 'cloexec'.
* tests: Rename capitests -> tests/c-api.Richard W.M. Jones2011-12-221-0/+142