Bug#290507: vim does not close file upon :sh
Bram Moolenaar
Bram at Moolenaar.net
Wed Jul 29 12:20:32 UTC 2009
James -
> > On Sat, Oct 07, 2006 at 03:32:45PM +0200, Bram Moolenaar wrote:
> >
> > ugh, cough, that's a dusty email!
>
> I finally had a chance to look into this and find how we could avoid it.
> :)
>
> > On Sat, Oct 07, 2006 at 03:32:45PM +0200, Bram Moolenaar wrote:
> > > > Hmm, perhaps the problem is that system() or execvp() doesn't close the
> > > > file descriptors in a child process?
> > >
> > > Indeed, that is the case. Children inherit their parent's file
> > > descriptors unless the file descriptors are set to close on exec().
> > > Attached patch does that.
> >
> > I don't think the FD_CLOEXEC flag is always available. I'm not sure
> > when it was added. Adding an autoconf check for it will help to avoid
> > breaking the build on old systems.
>
> I don't know autoconf, so I'm afraid I wouldn't be able to provide this
> part of the patch any time soon. FD_CLOEXEC is required by POSIX
> though, so I'm unsure how much this check is really needed.
>
> > This page mentions that one should get the flags first:
> > http://www.cs.ui.ac.id/WebKuliah/IKI10100/resources/contest/OnlineJudge/gnudoc/libc/Descriptor_Flags.html
>
> Ah, yes. Currently FD_CLOEXEC is the only supported flag, but that
> would be the proper way to do this for long-term robustness. Should I
> update this part of the patch or will you take care of it with the
> autoconf checks?
I would appreciate it if you can update the patch as far as you can and
test it. Then I'll have a look at it as well. It's always better to
have more than one person look at these things to avoid mistakes.
- Bram
--
hundred-and-one symptoms of being an internet addict:
116. You are living with your boyfriend who networks your respective
computers so you can sit in separate rooms and email each other
/// Bram Moolenaar -- Bram at Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
More information about the pkg-vim-maintainers
mailing list