mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Assume that O_CLOEXEC is always defined and works
This commit is contained in:
@@ -51,41 +51,6 @@ internal_setent (FILE **stream)
|
||||
|
||||
if (*stream == NULL)
|
||||
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
|
||||
else
|
||||
{
|
||||
#if !defined O_CLOEXEC || !defined __ASSUME_O_CLOEXEC
|
||||
# ifdef O_CLOEXEC
|
||||
if (__have_o_cloexec <= 0)
|
||||
# endif
|
||||
{
|
||||
/* We have to make sure the file is `closed on exec'. */
|
||||
int result;
|
||||
int flags;
|
||||
|
||||
result = flags = fcntl (fileno (*stream), F_GETFD, 0);
|
||||
if (result >= 0)
|
||||
{
|
||||
# ifdef O_CLOEXEC
|
||||
if (__have_o_cloexec == 0)
|
||||
__have_o_cloexec = (flags & FD_CLOEXEC) == 0 ? -1 : 1;
|
||||
if (__have_o_cloexec < 0)
|
||||
# endif
|
||||
{
|
||||
flags |= FD_CLOEXEC;
|
||||
result = fcntl (fileno (*stream), F_SETFD, flags);
|
||||
}
|
||||
}
|
||||
if (result < 0)
|
||||
{
|
||||
/* Something went wrong. Close the stream and return a
|
||||
failure. */
|
||||
fclose (*stream);
|
||||
stream = NULL;
|
||||
status = NSS_STATUS_UNAVAIL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
rewind (*stream);
|
||||
|
Reference in New Issue
Block a user