From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12031 invoked from network); 29 May 2002 13:02:36 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 29 May 2002 13:02:36 -0000 Received: (qmail 28076 invoked by alias); 29 May 2002 13:02:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17249 Received: (qmail 28063 invoked from network); 29 May 2002 13:02:27 -0000 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: Today's TCP Fix (TM) (3) Date: Wed, 29 May 2002 14:01:58 +0100 Message-ID: <24542.1022677318@csr.com> From: Peter Stephenson It's not useful to send the output to the zle file descriptor; it can't be redirected and it causes a crash in a subshell. I presume the most obvious thing is to send all expected messages to stdout. However, there's an argument for messages from the verbose options to go to stderr (which is what I originally wrote before realising it could be surprising). Another problem I've noticed, not fixed here, is that at the moment it's not possible to recover cleanly if someone else comes along and closes your fd's. They shouldn't, but it should be possible to remove the sessions none the less. Further, if you then attempt to unload zsh/net/tcp, the shell gets left in an inconsistent state and another `ztcp' causes a crash. Index: Src/Modules/tcp.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v retrieving revision 1.29 diff -u -r1.29 tcp.c --- Src/Modules/tcp.c 24 May 2002 13:02:01 -0000 1.29 +++ Src/Modules/tcp.c 29 May 2002 12:57:30 -0000 @@ -461,7 +461,7 @@ setiparam("REPLY", sess->fd); if (verbose) - fprintf(shout, "%d listener is on fd %d\n", ntohs(sess->sock.in.sin_port), sess->fd); + printf("%d listener is on fd %d\n", ntohs(sess->sock.in.sin_port), sess->fd); return 0; @@ -553,7 +553,7 @@ setiparam("REPLY", sess->fd); if (verbose) - fprintf(shout, "%d is on fd %d\n", ntohs(sess->peer.in.sin_port), sess->fd); + printf("%d is on fd %d\n", ntohs(sess->peer.in.sin_port), sess->fd); } else { @@ -575,7 +575,7 @@ remotename = ztpeer->h_name; else remotename = ztrdup(inet_ntoa(sess->peer.in.sin_addr)); - fprintf(shout, "%s:%d %s %s:%d is on fd %d%s\n", + printf("%s:%d %s %s:%d is on fd %d%s\n", localname, ntohs(sess->sock.in.sin_port), ((sess->flags & ZTCP_LISTEN) ? "-<" : ((sess->flags & ZTCP_INBOUND) ? "<-" : "->")), @@ -649,7 +649,7 @@ setiparam("REPLY", sess->fd); if (verbose) - fprintf(shout, "%s:%d is now on fd %d\n", + printf("%s:%d is now on fd %d\n", desthost, destport, sess->fd); } -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************