mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-12 05:34:41 -04:00
os: wrap F_DUPFD_CLOEXEC
Some system C libraries do not have F_DUPFD_CLOEXEC. Provide a fallback. Add tests for the new wl_os_dupfd_cloexec() wrapper. Add per-wrapper call counters in os_wrappers-test.c. Makes it easier to determine the minimum required number of wrapped calls. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
This commit is contained in:
parent
3b29783dc8
commit
1463a41f89
4 changed files with 91 additions and 4 deletions
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "wayland-util.h"
|
||||
#include "wayland-private.h"
|
||||
#include "wayland-os.h"
|
||||
|
||||
#define DIV_ROUNDUP(n, a) ( ((n) + ((a) - 1)) / (a) )
|
||||
|
||||
|
|
@ -518,7 +519,7 @@ wl_closure_vmarshal(struct wl_closure *closure,
|
|||
extra += sizeof *fd_ptr;
|
||||
|
||||
fd = va_arg(ap, int);
|
||||
dup_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
||||
dup_fd = wl_os_dupfd_cloexec(fd, 0);
|
||||
if (dup_fd < 0) {
|
||||
fprintf(stderr, "dup failed: %m");
|
||||
abort();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue