On 14-07-29 16:23, sebastien.ponc...@m4x.org wrote:
> Hi all,
> 
>   I've recently been enabled to use Eterm after an upgrade, because it
> freezes on start.

You should upgrade to Terminology :)

>  Using strace reveals that Eterm spends 100% CPU
> closing all file descriptors from 0 to 65535 in a tight loop (it
> restarts from 0 when reaching 65535).
>   Attaching in gdb gave me the culprit in the code : command.c lines
> 1562 to 1679, reproduced here :
> 
>     /*
>      * Close all file descriptors.  If only stdin/out/err are closed,
>      * child processes remain alive upon deletion of the window.
>      */
>     {
>         unsigned short i;
>         unsigned long max_fds;
> 
>         /* get number of available file descriptors */
> #ifdef _POSIX_VERSION
>         max_fds = sysconf(_SC_OPEN_MAX);
> #else
>         max_fds = getdtablesize();
> #endif
> 
>         D_TTY(("Closing file descriptors 0-%d.\n", max_fds));
>         for (i = 0; i < max_fds; i++) {
>             if (i != fd)
>                 close(i);
>         }
>         D_TTY(("...closed.\n"));
>     }
> 
> Guess what happens if sysconf(_SC_OPEN_MAX) returns 65536....
> A simple fix is to change the declaration of i to unsigned int. Although
> I'm not sure this loop is very efficient.

It should be turned into unsigned long, just like max_fds. I'll make the
patch tonight if nobody did it before.

-- 
Boris Faure
Pointer Arithmetician

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to