1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-03 08:11:03 +02:00

17220: Src/Modules/tcp.c: bugs using ztcp to list connections.

This commit is contained in:
Peter Stephenson 2002-05-24 13:01:57 +00:00
parent 205e07663f
commit 00d476ac20
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2002-05-24 Peter Stephenson <pws@csr.com>
* 17220: Src/Modules/tcp.c: bugs displaying host names and remote
host address when using `ztcp' to list connections.
2002-05-24 Sven Wischnowsky <wischnow@zsh.org> 2002-05-24 Sven Wischnowsky <wischnow@zsh.org>
* 17219: Src/Zle/complist.c: make re-display in menu selection * 17219: Src/Zle/complist.c: make re-display in menu selection

View file

@ -565,16 +565,16 @@ bin_ztcp(char *nam, char **args, char *ops, int func)
if (sess->fd != -1) if (sess->fd != -1)
{ {
zthost = gethostbyaddr((const void *)&(sess->sock.in.sin_addr), sizeof(struct sockaddr_in), AF_INET); zthost = gethostbyaddr((const void *)&(sess->sock.in.sin_addr), sizeof(sess->sock.in.sin_addr), AF_INET);
if (zthost) if (zthost)
localname = zthost->h_name; localname = zthost->h_name;
else else
localname = ztrdup(inet_ntoa(sess->sock.in.sin_addr)); localname = ztrdup(inet_ntoa(sess->sock.in.sin_addr));
ztpeer = gethostbyaddr((const void *)&(sess->peer.in.sin_addr), sizeof(struct sockaddr_in), AF_INET); ztpeer = gethostbyaddr((const void *)&(sess->peer.in.sin_addr), sizeof(sess->peer.in.sin_addr), AF_INET);
if (ztpeer) if (ztpeer)
remotename = ztpeer->h_name; remotename = ztpeer->h_name;
else else
remotename = ztrdup(inet_ntoa(sess->sock.in.sin_addr)); remotename = ztrdup(inet_ntoa(sess->peer.in.sin_addr));
fprintf(shout, "%s:%d %s %s:%d is on fd %d%s\n", fprintf(shout, "%s:%d %s %s:%d is on fd %d%s\n",
localname, ntohs(sess->sock.in.sin_port), localname, ntohs(sess->sock.in.sin_port),
((sess->flags & ZTCP_LISTEN) ? "-<" : ((sess->flags & ZTCP_LISTEN) ? "-<" :