Only try to set FD_CLOEXEC if this flag is defined

A/UX 3.x doesn't implement this constant, for example.
This commit is contained in:
Alexander Barton 2010-10-19 22:17:12 +02:00
parent 5f2bc55d36
commit 99e08eaced
1 changed files with 2 additions and 0 deletions

View File

@ -791,7 +791,9 @@ io_setcloexec(int fd)
int flags = fcntl(fd, F_GETFD);
if (flags == -1)
return false;
#ifdef FD_CLOEXEC
flags |= FD_CLOEXEC;
#endif
return fcntl(fd, F_SETFD, flags) == 0;
}