int which_dup)
{
- int rv;
-+ int rv, flags = 0;
++ int rv, fdflags;
if (which_dup == 2) {
if ((*new_file) == NULL) {
}
rv = dup2(old_file->filedes, (*new_file)->filedes);
+ if (!(old_file->flags & APR_INHERIT)) {
-+ flags = fcntl((*new_file)->filedes, F_GETFD);
-+ if (flags == -1)
++ fdflags = fcntl((*new_file)->filedes, F_GETFD);
++ if (fdflags == -1)
+ return errno;
-+ flags |= FD_CLOEXEC;
-+ if (fcntl((*new_file)->filedes, F_SETFD, flags) == -1)
++ fdflags |= FD_CLOEXEC;
++ if (fcntl((*new_file)->filedes, F_SETFD, fdflags) == -1)
+ return errno;
+ }
} else {
if (the##name->flag & APR_FILE_NOCLEANUP) \
return APR_EINVAL; \
if (!(the##name->flag & APR_INHERIT)) { \
-+ int flags = fcntl(the##name->name##des, F_GETFD); \
-+ if (flags == -1) \
++ int fdflags = fcntl(the##name->name##des, F_GETFD); \
++ if (fdflags == -1) \
+ return errno; \
-+ flags &= ~(FD_CLOEXEC); \
-+ if (fcntl(the##name->name##des, F_SETFD, flags) == -1) \
++ fdflags &= ~(FD_CLOEXEC); \
++ if (fcntl(the##name->name##des, F_SETFD, fdflags) == -1) \
+ return errno; \
the##name->flag |= APR_INHERIT; \
apr_pool_child_cleanup_set(the##name->pool, \
if (the##name->flag & APR_FILE_NOCLEANUP) \
return APR_EINVAL; \
if (the##name->flag & APR_INHERIT) { \
-+ int flags = fcntl(the##name->name##des, F_GETFD); \
-+ if (flags == -1) \
++ int fdflags = fcntl(the##name->name##des, F_GETFD); \
++ if (fdflags == -1) \
+ return errno; \
-+ flags |= FD_CLOEXEC; \
-+ if (fcntl(the##name->name##des, F_SETFD, flags) == -1) \
++ fdflags |= FD_CLOEXEC; \
++ if (fcntl(the##name->name##des, F_SETFD, fdflags) == -1) \
+ return errno; \
the##name->flag &= ~APR_INHERIT; \
apr_pool_child_cleanup_set(the##name->pool, \
int protocol, apr_pool_t *cont)
{
- int family = ofamily;
-+ int family = ofamily, flags = 0;
++ int family = ofamily, fdflags;
if (family == APR_UNSPEC) {
#if APR_HAVE_IPV6
}
set_socket_vars(*new, family, type, protocol);
-+ flags = fcntl((*new)->socketdes, F_GETFD);
-+ if (flags == -1)
++ fdflags = fcntl((*new)->socketdes, F_GETFD);
++ if (fdflags == -1)
+ return errno;
-+ flags |= FD_CLOEXEC;
-+ if (fcntl((*new)->socketdes, F_SETFD, flags) == -1)
++ fdflags |= FD_CLOEXEC;
++ if (fcntl((*new)->socketdes, F_SETFD, fdflags) == -1)
+ return errno;
+
(*new)->timeout = -1;
apr_pool_t *connection_context)
{
- int s;
-+ int s, flags;
++ int s, fdflags;
apr_sockaddr_t sa;
sa.salen = sizeof(sa.sa);
(*new)->local_interface_unknown = 1;
}
-+ flags = fcntl((*new)->socketdes, F_GETFD);
-+ if (flags == -1)
++ fdflags = fcntl((*new)->socketdes, F_GETFD);
++ if (fdflags == -1)
+ return errno;
-+ flags |= FD_CLOEXEC;
-+ if (fcntl((*new)->socketdes, F_SETFD, flags) == -1)
++ fdflags |= FD_CLOEXEC;
++ if (fcntl((*new)->socketdes, F_SETFD, fdflags) == -1)
+ return errno;
+
(*new)->inherit = 0;