about summary refs log tree commit diff
path: root/Src/Modules/zselect.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-05-08 14:25:57 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-05-08 14:25:57 +0000
commit2f9ba2f0f9690db2bd48bb0b5d7f6393a8aabd03 (patch)
treee6259d6181bf62db317db69cf69e85418bdf1b98 /Src/Modules/zselect.c
parentc5381b85ed6e5466a5eec780480b429878bdec5d (diff)
downloadzsh-2f9ba2f0f9690db2bd48bb0b5d7f6393a8aabd03.tar.gz
zsh-2f9ba2f0f9690db2bd48bb0b5d7f6393a8aabd03.tar.xz
zsh-2f9ba2f0f9690db2bd48bb0b5d7f6393a8aabd03.zip
17095: Bug in setting associative array; remove unused counter
Diffstat (limited to 'Src/Modules/zselect.c')
-rw-r--r--Src/Modules/zselect.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Src/Modules/zselect.c b/Src/Modules/zselect.c
index 827a97797..2eee59d03 100644
--- a/Src/Modules/zselect.c
+++ b/Src/Modules/zselect.c
@@ -37,8 +37,7 @@
  * Return 1 for error (after printing a message), 0 for OK.
  */
 static int
-handle_digits(char *nam, char *argptr, fd_set *fdset, int *fdcount,
-	      int *fdmax)
+handle_digits(char *nam, char *argptr, fd_set *fdset, int *fdmax)
 {
     int fd;
     char *endptr;
@@ -54,7 +53,6 @@ handle_digits(char *nam, char *argptr, fd_set *fdset, int *fdcount,
     }
 
     FD_SET(fd, fdset);
-    (*fdcount)++;
     if (fd+1 > *fdmax)
 	*fdmax = fd+1;
     return 0;
@@ -67,7 +65,7 @@ static int
 bin_zselect(char *nam, char **args, char *ops, int func)
 {
 #ifdef HAVE_SELECT
-    int i, fd, fdsetind = 0, fdcount = 0, fdmax = 0;
+    int i, fd, fdsetind = 0, fdmax = 0, fdcount;
     fd_set fdset[3];
     const char fdchar[3] = "rwe";
     struct timeval tv, *tvptr = NULL;
@@ -166,12 +164,11 @@ bin_zselect(char *nam, char **args, char *ops, int func)
 		    /* Digits following option without arguments are fd's. */
 		default:
 		    if (handle_digits(nam, argptr, fdset+fdsetind,
-				      &fdcount, &fdmax))
+				      &fdmax))
 			return 1;
 		}
 	    }
-	} else if (handle_digits(nam, argptr, fdset+fdsetind, &fdcount,
-				 &fdmax))
+	} else if (handle_digits(nam, argptr, fdset+fdsetind, &fdmax))
 	    return 1;
     }
 
@@ -220,7 +217,7 @@ bin_zselect(char *nam, char **args, char *ops, int func)
 				strcpy(buf, data);
 				for (ptr = buf; *ptr; ptr++)
 				    ;
-				*ptr++ = fdchar[1];
+				*ptr++ = fdchar[i];
 				*ptr = '\0';
 				zsfree(data);
 				*dataptr = ztrdup(buf);