apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 46425] Apr should set FD_CLOEXEC if APR_FOPEN_NOCLEANUP is not set
Date Sun, 22 Feb 2009 12:34:01 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=46425





--- Comment #7 from Stefan Fritsch <sf@sfritsch.de>  2009-02-22 04:33:58 PST ---
(In reply to comment #2)
> Note that any place a particular object is changed to rely on FD_CLOEXEC for
> closure after exec, the corresponding child cleanup needs to be changed (or if
> appropriate, removed) since it will otherwise also try to close() the fd for a
> second time.

It is not strictly necessary to change the cleanups because they run before the
exec. When a file was closed by the cleanup is no longer relevant if it had
FD_CLOEXEC or not. From a performance point of view, the unnecessary cleanups
should be removed, of course.

If this patch is ever backported to 1.3/1.4, I would suggest not to remove the
cleanups there, to retain maximum compatibility (some apps could mess with the
cleanups, after all).

> Lots of system call invocations:
> 
> +        int fdflags = fcntl(fd, F_GETFD);
> +        fdflags |= FD_CLOEXEC;
> +        fcntl(fd, F_SETFD, fdflags);
> 
> without any error checking seems kinda bad, but maybe that's unnecessary
> paranoia.

The only relevant failure modes are EBADF, if the fd is invalid, and EINVAL, if
FD_CLOEXEC is unknown. I think we can ignore the latter case and only do error
checking on fcntl in cases where we haven't verified that fd is valid, yet.

But I would be fine with adding error checking in all cases, of course.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message