This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
static int have_accept4_really; /* 0 = unknown, 1 = yes, -1 = no */
if (have_accept4_really >= 0)
{
static int have_accept4_really; /* 0 = unknown, 1 = yes, -1 = no */
if (have_accept4_really >= 0)
{
- int result = accept4 (sockfd, addr, addrlen, flags);
- if (!(result < 0 && errno == ENOSYS))
- {
- have_accept4_really = 1;
- return result;
- }
- have_accept4_really = -1;
+ int result = accept4 (sockfd, addr, addrlen, flags);
+ if (!(result < 0 && errno == ENOSYS))
+ {
+ have_accept4_really = 1;
+ return result;
+ }
+ have_accept4_really = -1;
- if (!DuplicateHandle (curr_process, /* SourceProcessHandle */
- old_handle, /* SourceHandle */
- curr_process, /* TargetProcessHandle */
- (PHANDLE) &new_handle, /* TargetHandle */
- (DWORD) 0, /* DesiredAccess */
- FALSE, /* InheritHandle */
- DUPLICATE_SAME_ACCESS)) /* Options */
- {
- close (fd);
- errno = EBADF; /* arbitrary */
- return -1;
- }
+ if (!DuplicateHandle (curr_process, /* SourceProcessHandle */
+ old_handle, /* SourceHandle */
+ curr_process, /* TargetProcessHandle */
+ (PHANDLE) &new_handle, /* TargetHandle */
+ (DWORD) 0, /* DesiredAccess */
+ FALSE, /* InheritHandle */
+ DUPLICATE_SAME_ACCESS)) /* Options */
+ {
+ close (fd);
+ errno = EBADF; /* arbitrary */
+ return -1;
+ }
- || fcntl (fd, F_SETFD, fcntl_flags | FD_CLOEXEC) == -1)
- {
- int saved_errno = errno;
- close (fd);
- errno = saved_errno;
- return -1;
- }
+ || fcntl (fd, F_SETFD, fcntl_flags | FD_CLOEXEC) == -1)
+ {
+ int saved_errno = errno;
+ close (fd);
+ errno = saved_errno;
+ return -1;
+ }