On 16/06/2014, at 1:38 PM, Brandon Allbery wrote:
> On Sun, Jun 15, 2014 at 8:15 PM, Ian Wadham <iandw...@gmail.com> wrote:
> Later the the FDs get closed anyway and it works then, perhaps because
> the app gets issued with a STOP.
> 
> Unix closes all fd-s at process exit (including abnormal exit) anyway; 
> closing them preemptively like that doesn't make a whole lot of sense.

Yes, understood.

>  The normal time you need such code is after a fork() and before exec() to 
> avoid leaking file descriptors to a child that won't know they're even there.

Something like that happens in later KDE crash-processing code, which
starts Dr Konqi (the crash-processing dialog app), but I have not looked at
it in detail yet.  It first tries to get a third party (kdeinit) to start Dr 
Konqi.
This is preferred (the comments say) because it avoids inheriting possibly
corrupted data.  But if that fails, it forks and starts Dr Konqi as a child.

Cheers, Ian W.

_______________________________________________
macports-dev mailing list
macports-dev@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-dev

Reply via email to