Re: closing extra fd's in gnome_execute_*



Manish Vachharajani <mvachhar@vger.rutgers.edu> writes:

> Since you don't like the behavior though, I will add functions that will
> not close the fd's.  There is no reason to have all these open files
> around anyway.  It can become problematic if someone opens a large file
> and it gets inherited.  If this happens, I can't delete it for instance if
> my fs is full and regain the space.  What's worse is I may have no clue
> who has it open.  For people that want to open pipes and such(just the
> type of thing I was wondering if it was done or not with the current
> stuff) they can use the new functions that I will add.  It seems most
> people don't intend to keep the other fd's open anyway.

Well, if I understand this correctly, any program expecting any other file
descriptor than 0, 1 or 2 open won't work when invoked in the shell for
most people (don't know - is something like `foo 5<bar' valid shell syntax?).

Even if the shell passed all currently open file descriptors to the shell -
do we have any GNOME program reading from standard input or writing to
standard output ? I don't think we have. If we don't have GNOME programs
reading standard input and writing standard output do we have any GNOME
program reading and/or writing to any other filedescriptor - and thus
expecting them to be open ?

Normally, GNOME programs don't use any filedescriptors at all on startup
so I think it's safe to close everything except 0, 1 and 2 and provide
functions that leave them open in case someone really wants this.

Martin

-- 
-----------------------------------------------------------------
   Martin Baulig - Angewandte Mathematik - Universitaet Trier
   martin@home-of-linux.org, http://www.home-of-linux.org/
------------------------------------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]