On Tue, Sep 25, 2012 at 2:06 PM, Florian Fainelli <[email protected]> wrote:
> From: Hasmish Guthrie <[email protected]>
>
> Default behavior for a non-interactive shell is that SIGINT is processeld
> locally by the shell (and typically ignored), this runtime environment is
> inherited by children, hence Ctrl-C has no effect within a telnet session.
> This patch enables the correct behavior.
Your shell is buggy. It must not pass SIGINT set to SIG_IGN to children.
Mine does not:
$ strace -oLOG -tt sh -c 'busybox telnetd -F -l cat'
$ busybox telnet 127.0.0.1
Entering character mode
Escape character is '^]'.
Fedora release 16 (Verne)
Kernel 3.4.2-1.fc16.i686.PAE on an i686 (/dev/pts/3)
^CConnection closed by foreign host
LOG:
pid 12647 is telnetd
pid 12652 is cat
12652 17:17:29.230019 read(0, <unfinished ...>
12647 17:17:29.750303 <... select resumed> ) = 1 (in [4])
12647 17:17:29.750414 read(4, "\3", 2026) = 1
^^^^^^^ telnetd: got ^C from network
12647 17:17:29.750574 select(6, [3 4 5], [5], NULL, NULL) = 1 (out [5])
12647 17:17:29.750753 write(5, "\3", 1) = 1
^^^^^^^ telnetd: sending it to pty
12652 17:17:29.750883 <... read resumed> 0x8f6c000, 32768) = ?
ERESTARTSYS (To be restarted if SA_RESTART is set)
^^^^^^^ cat: read is interrupted by a signal
12647 17:17:29.750926 select(6, [3 4 5], [], NULL, NULL <unfinished ...>
12652 17:17:29.750969 --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
^^^^^^^ cat: it's SIGINT
12647 17:17:29.751010 <... select resumed> ) = 1 (in [5])
12647 17:17:29.751070 read(5, "^C", 2026) = 2
^^^^^^^ telnetd: read pty's response echo of ^C
12647 17:17:29.751181 select(6, [3 4 5], [4], NULL, NULL <unfinished ...>
12652 17:17:29.751241 +++ killed by SIGINT +++
^^^^^^^ cat: dies
12647 17:17:29.751273 <... select resumed> ) = 2 (in [5], out [4])
12647 17:17:29.751334 write(4, "^C", 2) = 2
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox