Displaying 5 results from an estimated 5 matches for "fdsetsz".
2002 May 22
0
[PATCH] connect() timeout
...RIG Tue Mar 5 19:59:46 2002
+++ openssh-3.2.2p1/sshconnect.c Tue May 21 15:40:06 2002
@@ -222,6 +222,63 @@
return sock;
}
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ fd_set *fdset;
+ struct timeval tv;
+ socklen_t optlen;
+ int fdsetsz, optval, rc;
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
+ return -1;
+
+ rc = connect(sockfd, serv_addr, addrlen);
+ if (rc == 0)
+ return 0;
+ if (errno != EINPROGRESS)
+ return -1;
+
+ fdsetsz = howmany(sockfd+1,...
2003 Apr 15
0
Connect timeout patch
...c.ORIG Tue Apr 15 23:06:30 2003
+++ openssh-3.6.1p1/sshconnect.c Tue Apr 15 23:08:28 2003
@@ -212,6 +212,61 @@
return sock;
}
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ fd_set *fdset;
+ struct timeval tv;
+ socklen_t optlen;
+ int fdsetsz, optval, rc;
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
+ return -1;
+
+ rc = connect(sockfd, serv_addr, addrlen);
+ if (rc == 0)
+ return 0;
+ if (errno != EINPROGRESS)
+ return -1;
+
+ fdsetsz = howmany(sockfd+1,...
2003 May 17
0
opensshd fd_set definition problem
...== by 0x403DC5CC: __libc_start_main (in
/lib/libc-2.3.2.so)
==1059== by 0x804C560: (within /usr/sbin/sshd)
==1059== Address 0x41363BFC is 0 bytes after a block of
size 4 alloc'd
==1058== checked 5467064 bytes.
This turns out to be around line 1261 in sshd.c:
fd_set *fdset;
...snip...
fdsetsz = howmany(maxfd+1, NFDBITS) * sizeof(fd_mask);
fdset = (fd_set *)xmalloc(fdsetsz);
...snip...
ret = select(maxfd+1, fdset, NULL, NULL, NULL);
My question is why don't you use:
fdsetsz = sizeof( fd_set );
The 2.4.20 Linux kernel defines fd_set like this:
#define __NFDBITS (8 * sizeof(...
2002 Oct 17
0
[PATCH] connect() timeout for OpenSSH-3.5p1
...t.c.ORIG Thu Sep 19 04:05:04 2002
+++ openssh-3.5p1/sshconnect.c Wed Oct 16 14:59:12 2002
@@ -212,6 +212,61 @@
return sock;
}
+int
+timeout_connect(int sockfd, const struct sockaddr *serv_addr,
+ socklen_t addrlen, int timeout)
+{
+ fd_set *fdset;
+ struct timeval tv;
+ socklen_t optlen;
+ int fdsetsz, optval, rc;
+
+ if (timeout <= 0)
+ return(connect(sockfd, serv_addr, addrlen));
+
+ if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
+ return -1;
+
+ rc = connect(sockfd, serv_addr, addrlen);
+ if (rc == 0)
+ return 0;
+ if (errno != EINPROGRESS)
+ return -1;
+
+ fdsetsz = howmany(sockfd+1,...
2003 Sep 10
3
[PATCH] No extern declarations of optarg & co if getopt.h is available
...iff -p -u -r1.260 sshd.c
--- sshd.c 2 Sep 2003 12:51:17 -0000 1.260
+++ sshd.c 10 Sep 2003 18:59:02 -0000
@@ -797,8 +797,10 @@ usage(void)
int
main(int ac, char **av)
{
+#ifndef HAVE_GETOPT_H
extern char *optarg;
extern int optind;
+#endif
int opt, sock_in = 0, sock_out = 0, newsock, j, i, fdsetsz, on = 1;
pid_t pid;
socklen_t fromlen;
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.