Re: closing extra fd's in gnome_execute_*

On 10 Jan 1999, Martin Baulig wrote:

> 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?).

I have no idea if this is valid 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 ?

Well, stdin, stdout, and stderr, are not the issue.  gnome-pty-helper for
example uses 0, 1, and 2.  I have already added the code the closes the
additional descriptors if any, and nothing seems to break.  I have also
added _with_fds variants of the functions so anyone who wants the fd's
open can have it.
> 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.

These are my thoughts exactly, and that is what I have done :)

> Martin

Manish Vachharajani               Some Haiku: A crash reduces
<>                   your expensive computer
                                              to a simple stone - Unknown

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