zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: fix select polling in ztcp and zsocket
@ 2015-07-20 13:14 Joshua Krusell
  0 siblings, 0 replies; only message in thread
From: Joshua Krusell @ 2015-07-20 13:14 UTC (permalink / raw)
  To: zsh-workers

ztcp -t and zsocket -t are broken on systems using select()
/jsks


diff --git a/Src/Modules/socket.c b/Src/Modules/socket.c
index 6c70d31..cd56d46 100644
--- a/Src/Modules/socket.c
+++ b/Src/Modules/socket.c
@@ -175,7 +175,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func))
 	    tv.tv_sec = 0;
 	    tv.tv_usec = 0;
 	    
-	    if ((ret = select(lfd+1, &rfds, NULL, NULL, &tv))) return 1;
+	    if ((ret = select(lfd+1, &rfds, NULL, NULL, &tv)) == 0) return 1;
 	    else if (ret == -1)
 	    {
 		zwarnnam(nam, "select error: %e", errno);
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index 0d95220..d5b62a8 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -519,7 +519,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func))
 	    tv.tv_sec = 0;
 	    tv.tv_usec = 0;
 	    
-	    if ((ret = select(lfd+1, &rfds, NULL, NULL, &tv))) return 1;
+	    if ((ret = select(lfd+1, &rfds, NULL, NULL, &tv)) == 0) return 1;
 	    else if (ret == -1)
 	    {
 		zwarnnam(nam, "select error: %e", errno);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-20 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-20 13:14 PATCH: fix select polling in ztcp and zsocket Joshua Krusell

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).