Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: fix select polling in ztcp and zsocket



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);



Messages sorted by: Reverse Date, Date, Thread, Author